Ledig (better translated with unmarried or never married) contrasts with verheiratet (married), geschieden (divorced), verwitwet (widowed) and the obsolete verpartnert which until 2017 was in use to describe married in a same-sex marriage. (This is the legal case in the Federal Republic of Germany; legalities in Switzerland, Austria, Liechtenstein, Luxemburg, Belgium and South Tyrol will differ.) While these terms are also used in everyday language, they are the terms of choice in legal documents. For example if you pay taxes in Germany, you may be required to choose a tax class based on your marital status and only verheiratet gives you access to tax classes III, IV and V.
Sometimes in official forms, the only distinction is made between verheiratet and unverheiratet (married versus not married); lumping the other three into unverheiratet.
In everyday life, where it is not so important whether one is wearing a wedding ring, the noun Single meaning not currently in a relationship is commonly used; you can be legally married but living separated from your partner and declare yourself Single while out flirting. Likewise, an unmarried person in a relationship would not declare themselves Single unless they are looking for an affair.
In contrast with the other term it is important to note that everybody can be classified as ledig, verheiratet, geschieden or verwitwet.
Alleinerziehend is a term to describe a certain type of parenthood: single parenthood. To qualify for the term alleinerziehend, a person must be living alone and have a child who has not yet grown up. If there is no child, you are not alleinerziehend and if there is some kind of a partner in the same household you are not alleinerziehend.
A person who is alleinerziehend can be in any of the four legal marital statuses:
If the child’s mother is living alone and was never married (e.g. her relationship to the child’s father was a one-night stand, broke up before birth or he died early) she is alleinerziehend und ledig – until the child is 18 when she is no longer considered alleinerziehend;
If the child was born in wedlock but the marriage went south, the parents are now separated, the children with the father but the couple not yet legally divorced, the father is verheiratet und alleinerziehend;
After the couple of the previous example finalise the divorce, the father is now geschieden und alleinerziehend;
If, on the other hand, a (different) family where the parents are married is involved in a car crash which takes the life of the father, the remaining mother will be alleinerziehend und verwitwet.
In all of these examples once the children are grown up and move out, the person loses the alleinerziehend part of the description and remains ledig/verheiratet/geschieden/verwitwet.
By contrary, picture a couple that for whatever reason decided not to marry yet is living together and has a child. The two parents are not alleinerziehend even though both parents might legally be ledig simply because they are living together.
It gets more fuzzy if you want to start drawing lines between edge cases. E.g. is a single mother in a flatshare alleinerziehend or not? I wouldn’t know off the top of my head.