Math fab Mathonwy, "Math, the son of Mathonwy" is a legendary tale from medieval Welsh literature and the final of the four branches of the Mabinogi. It tells of a vicious war between the north and the south, of the birth of Lleu Llaw Gyffes and Dylan ail Don, of the tyngedau of Arianrhod, and of the creation of Blodeuwedd, a woman made of flowers. The chief characters of the tale are Math, king of Gwynedd, his nephew Gwydion, a magician, warrior and trickster, and Gwydion's own nephew, Lleu, cursed by his mother Arianrhod.
Along with the other branches, the tale can be found the medieval Red Book of Hergest and White Book of Rhydderch. Allusions to the tale can be found in two old triads retained in the Trioedd Ynys Prydain
Gilfaethwy, nephew to the Venedotian king, Math fab Mathonwy, falls in love with his uncle's virgin foot-holder, Goewin. His brother Gwydion conspires to start a war between the north and the south, so as give the brothers the opportunity to rape Goewin while Math is distracted. To this end, Gwydion employs his magic powers to steal a number of otherworldy pigs from the Demetian king, Pryderi, who retaliates by marching on Gwynedd. Meanwhile, Gwydion and Gilfaethwy attack and rape Goewin.
Pryderi and his men march north and fight a battle between Maenor Bennardd and Maenor Coed Alun, but are forced to retreat. He is pursued to Nant Call, where more of his men are slaughtered, and then to Dol Benmaen, where he suffers a third defeat. To avoid further bloodshed, it is agreed that the outcome of the battle should be decided by single combat between Gwydion and Pryderi. The two contenders meet at a place called Y Velen Rhyd in Ardudwy, and "because of strength and valour and magic and enchantment", Gwydion triumphs and Pryderi is killed. The men of Dyfed retreat back to their own land, lamenting over the death of their lord.
When Math hears of the assault on Goewin, he turns his nephews into a series of mated pairs of animals: Gwydion becomes a stag for a year, then a sow and finally a wolf. Gilfaethwy becomes a hind deer, a boar and a she-wolf. Each year they produce an offspring which is sent to Math: Hyddwn, Hychddwn and Bleiddwn. After three years, Math releases his nephews from their punishment and begins the search for a new foot-holder. Gwydion suggests his sister Arianrhod, who is magically tested for virginity by Math. During the test, she gives birth to a "sturdy boy with thick yellow hair" whom Math names Dylan and who takes on the nature of the seas until his death at his uncle Gofannon's hands.
Ashamed, Arianrhod runs to the door, but on her way out something small drops from her, which Gwydion wraps up and places in a chest at the foot of his bed. Some time later, he hears screams from within the chest, and opens it to discover a baby boy. Some scholars have suggested that in an earlier form of the Fourth Branch, Gwydion was the father of Arianrhod's sons.
Some years later, Gwydion accompanies the boy to Caer Arianrhod, and presents him to his mother. The furious Arianrhod, shamed by this reminder of her loss of virginity, places a tynged on the boy: that only she could give him a name. Gwydion however tricks his sister by disguising himself and the boy as cobblers and luring Arianrhod into going to them in person in order to have some shoes made for her. The boy throws a stone and strikes a wren "between the tendon and the bone of its leg", causing Arianrhod to make the remark "it is with a skillful hand that the fair-haired one has hit it ". At that Gwydion reveals himself, saying Lleu Llaw Gyffes; "the fair-haired one with the skillful hand, is his name now". Furious at this trickery, Arianrhod places another tynged on Lleu: he shall receive arms from no one but Arianrhod herself. Gwydion tricks his sister once again, and she unwittingly arms Lleu herself, leading to her placing a third tynged on him: that he shall never have a human wife.
So as to counteract Arianrhod's curse, Math and Gwydion:
While Lleu is away on business, Blodeuwedd has an affair with Gronw Pebr, the lord of Penllyn, and the two conspire to murder Lleu. Blodeuwedd tricks Lleu into revealing how he may be killed, since he can not be killed during the day or night, nor indoors or outdoors, neither riding nor walking, not clothed and not naked, nor by any weapon lawfully made. He reveals to her that he can only be killed at dusk, wrapped in a net with one foot on a cauldron and one on a goat and with a spear forged for a year during the hours when everyone is at mass. With this information she arranges his death.
Struck by the spear thrown by Gronw's hand, Lleu transforms into an eagle and flies away. Gwydion tracks him down and finds him perched high on an oak tree. Through the singing of an englyn (known as englyn Gwydion) he lures him down from the oak tree and switches him back to his human form. Gwydion and Math nurse Lleu back to health before mustering Gwynedd and reclaiming his lands from Gronw and Blodeuwedd.
Gwydion overtakes a fleeing Blodeuwedd and turns her into an owl, the creature hated by all other birds, proclaiming:
The narrative adds:
Meanwhile, Gronw escapes to Penllyn and sends emissaries to Lleu to beg of his forgiveness. Lleu refuses, demanding that Gronw must stand on the bank of the River Cynfael and receive a blow from his spear. Gronw desperately asks if anyone from his warband will take the spear in his place, but his men refuse his plea. Eventually, Gronw agrees to receive the blow on the condition that he may place a large stone between himself and Lleu, who allows him to do so before throwing the spear with such strength that it pierces the stone, killing his rival. A holed stone in Ardudwy is still known as Llech Ronw (Gronw's Stone).
The tale ends with Lleu ascending to the throne of Gwynedd.