Mathgamain (d. 976), son of Cennétig and king of North Munster, belonged to the Uí Thairdelbaig lineage of the Dál Cais dynasty. His father Cennétig (qv) (d. 951) had made himself the dominant ruler in the north of the province. The identity of Mathgamain's mother is not preserved, but he is said to have had eleven half-brothers. The names of two siblings, Dub and Finn, allegedly slain at the battle of Gort Rottacháin (944), appear fictitious. Two of his brothers, Echthigern and Donn-cuan were slain (950) by the Uí Néill king Congalach Cnogba (qv) son of Máel-mithig. Another brother, Lachtna, died (953) as king of North Munster; Marcán died (1010) as abbot of Emly; the most distinguished member of the family was, undoubtedly, the youngest brother Brian Bórama (qv). Mathgamain had a sister, Órlaith, who was married to the king of Tara, Donnchad Donn (qv) son of Flann Sinna (qv). There is no record of his wife, but he had at least one son, Áed (d. 1011).
Although he does not seem to have attained an effective kingship for several years after the death of Lachtna, by the early 960s Mathgamain had emerged to contest the suzerainty of Munster with the Éoganacht ruler, Máel-muad son of Bran. In 964 Mathgamain, whose supporters included minor nobility from around Limerick, marched to Cashel and seized the lands of Éoganacht Chaisil. His rival, Máel-muad, secured the support of the Norsemen of Limerick and of the Uí Fhidgenti, an old dynasty which claimed to rule the western area of Co. Limerick. Mathgamain dealt first with the Norsemen, defeating them in 967 at the battle of Sulchóit (Solohead, on the Limerick–Tipperary border). Subsequently, he captured and sacked the settlement of Limerick, acquiring great riches in the process.
In 969 Mathgamain took the hostages of Uí Fhidgenti, and again defeated the Norse of Limerick. The same year, the overking of Leinster invaded the realm of Osraige in the Nore valley, and Mathgamain was able to command the forces of northern and eastern Munster, including those of the Norse of Waterford. He manipulated his rivals in an effort to become overking of the province. In 972, with the support of Máel-muad and the king of the Déisi, he again captured and gained control of Limerick. The Norse rulers were expelled from the settlement, and fled to King's Island in the Shannon.
Mathgamain was now the most powerful ruler in Munster; as such, he intervened when the ecclesiastical head of Emly disputed rights regarding dues with the successor of St Patrick (qv), Dub-dá-Leithe son of Cellach; whether he disdained the old Éoganacht associations of Emly or feared the Uí Néill support for Armagh, he acknowledged the Armagh claims. In 974 Mathgamain faced a revolt against his overlordship when his rival Máel-muad took the hostages of southern Munster and opened hostilities. The end came for Mathgamain in 976, when the king of Uí Fhidgenti defected and betrayed his overlord to Máel-muad, who had him executed. Mathgamain was succeeded as ruler of northern Munster by his brother, Brian Bórama. The family line of Mac Mathgamna (MacMahon) descended from Mathgamain.