{"id":1345,"date":"2016-02-29T13:01:32","date_gmt":"2016-02-29T21:01:32","guid":{"rendered":"http:\/\/www.elbeno.com\/blog\/?p=1345"},"modified":"2016-02-29T13:01:32","modified_gmt":"2016-02-29T21:01:32","slug":"eli5-monoids","status":"publish","type":"post","link":"https:\/\/www.elbeno.com\/blog\/?p=1345","title":{"rendered":"ELI5: monoids"},"content":{"rendered":"<p>(Resulting from my claim that &#8220;a child of 8 can understand monoids&#8230;&#8221;)<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Monoid\">Wikipedia<\/a> says: &#8220;In abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a single associative binary operation and an identity element.&#8221;<\/p>\n<p><a href=\"http:\/\/mathworld.wolfram.com\/Monoid.html\">Wolfram<\/a> says: A monoid is a set that is closed under an associative binary operation and has an identity element I &isin; S such that for all a &isin; S, Ia = aI = a.<\/p>\n<p>Mathematics has to be precise, which is why it uses jargon. But what do these concise definitions mean in everyday language? Consider adding up numbers.<\/p>\n<ul>\n<li>The set is the whole numbers (and we need zero). 0, 1, 2, 3 etc.<\/li>\n<li>The associative binary operation is addition.\n<ul>\n<li>&#8220;binary&#8221; just means it&#8217;s a thing you do to two numbers.<\/li>\n<li>&#8220;associative&#8221; means it doesn&#8217;t matter what order you group things in. 1 + 2 + 3 gives the same answer whether you add 1 and 2 first and then add 3, or add 2 and 3 first and then add the answer to 1.<\/li>\n<\/ul>\n<li>The set being &#8220;closed&#8221; under addition means that when you add two numbers you get another number &#8211; you don&#8217;t get some other kind of thing. (You might think this is obvious, but in maths it has to be stated.)<\/li>\n<li>The identity element is 0 &#8211; the thing that doesn&#8217;t make any difference when you add it. Anything plus zero is itself.<\/li>\n<\/ul>\n<p>So adding whole numbers is a monoid. A mathematician would say that the non-negative integers form a monoid under addition. The important thing is that the numbers aren&#8217;t a monoid on their own; it&#8217;s the combination of the set (0, 1, 2, 3&#8230;) <em>and<\/em> the operation (+) that makes the monoid. If we chose another operation, we could get another monoid. Think about multiplication, for instance.<\/p>\n<p>It turns out that lots of things behave the same way as addition on numbers, which is why the notion of a monoid is very useful to mathematicians and computer scientists.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Resulting from my claim that &#8220;a child of 8 can understand monoids&#8230;&#8221;) Wikipedia says: &#8220;In abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a single associative binary operation and an identity element.&#8221; Wolfram says: A monoid is a set that is closed under an associative&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1345","post","type-post","status-publish","format-standard","hentry","category-maths"],"_links":{"self":[{"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1345"}],"version-history":[{"count":5,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1345\/revisions"}],"predecessor-version":[{"id":1350,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1345\/revisions\/1350"}],"wp:attachment":[{"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elbeno.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}