A ditty is a short, simple song, like the ones I write. It comes from the Old French dite (composition), from the Latin dictatum (something dictated), from dictare (to dictate), a frequentative of dicere (to say, speak), which is related to dicare (to proclaim, dedicate), from the Proto-Indo-European root *deik- (to point out).
Some English words that come from the same root include dictate, diction, and digit, which came to be related to numbers as a result of counting on fingers. Other words that developed from this root include the Latin digitus (finger), the German zeigen, the Greek δίκη [díkê] (custom, right, judgement), and quite a few more.
The word teach also comes from the *deik-, via the Old English tæcan (to show, point out, declare, demonstrate; to give instruction, train, assign, direct; warn; persuade), from the Proto-Germanic *taikijan (to show).
Source: Online Etymology Dictionary, Oxford Dictionaries and the Indo-European Lexicon.