{"id":2610,"date":"2018-12-21T23:06:21","date_gmt":"2018-12-22T05:06:21","guid":{"rendered":"https:\/\/laurentlessard.com\/bookproofs\/?p=2610"},"modified":"2018-12-22T01:24:34","modified_gmt":"2018-12-22T07:24:34","slug":"elf-music","status":"publish","type":"post","link":"https:\/\/laurentlessard.com\/bookproofs\/elf-music\/","title":{"rendered":"Elf music"},"content":{"rendered":"<p>This holiday-themed <a href=\"https:\/\/fivethirtyeight.com\/features\/santa-needs-some-help-with-math\/\">Riddler problem<\/a> is about probability:<\/p>\n<blockquote><p>\nIn Santa\u2019s workshop, elves make toys during a shift each day. On the overhead radio, Christmas music plays, with a program randomly selecting songs from a large playlist.<\/p>\n<p>During any given shift, the elves hear 100 songs. A cranky elf named Cranky has taken to throwing snowballs at everyone if he hears the same song twice. This has happened during about half of the shifts. One day, a mathematically inclined elf named Mathy tires of Cranky\u2019s sodden outbursts. So Mathy decides to use what he knows to figure out how large Santa\u2019s playlist actually is.<\/p>\n<p>Help Mathy out: How large is Santa\u2019s playlist?<\/p><\/blockquote>\n<p>Here is my solution:<br \/>\n<a href=\"javascript:Solution('soln_elf_music','toggle_elf_music')\" id=\"toggle_elf_music\">[Show Solution]<\/a><\/p>\n<div id=\"soln_elf_music\" style=\"display: none\">\n<p>This problem is short and sweet. The probability in question seems complicated, because there are so many different ways in which a song (or several songs) could repeat. This is made much easier by using complementarity. Namely:<br \/>\n\\[<br \/>\n\\mathrm{Prob}(\\text{at least one song repeats}) = 1-\\mathrm{Prob}(\\text{no songs repeat})<br \/>\n\\]And the probability that no songs repeat is simply the probability that all songs are different. This is much easier to calculate! Let&#8217;s call $p$ the probability that at least one song gets played twice and let&#8217;s say there are $n$ different songs on the playlist. Then we have:<br \/>\n\\begin{align}<br \/>\np &#038;= 1-\\mathrm{Prob}(\\text{all }100\\text{ songs are different})\\\\<br \/>\n&#038;= 1-\\frac{(\\text{number of ways of picking }100\\text{ different songs})}{(\\text{number of ways of picking }100\\text{ songs})}\\\\<br \/>\n&#038;= 1-\\frac{n(n-1)(n-2)\\cdots(n-99)}{n^{100}} \\\\<br \/>\n&#038;= 1-\\binom{n}{100}\\frac{100!}{n^{100}}<br \/>\n\\end{align}Of course, this formula is only valid if $n\\ge 100$. If there aren&#8217;t at least $100$ songs, then by the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pigeonhole_principle\">Pigeonhole Principle<\/a>, a song getting picked twice is inevitable. The formula for the probability $p$ of hearing at least one repeated song as a function of the number of different songs $n$ is therefore:<\/p>\n<p style=\"text-align: center;\"><span style=\"background-color: #AFC8E6; padding: 25px 10px 25px 10px;\">$\\displaystyle<br \/>\np = \\begin{cases}<br \/>\n1 &#038; \\text{if }1 \\le n \\le 99\\\\<br \/>\n1-\\binom{n}{100}\\frac{100!}{n^{100}} &#038; \\text{if }n \\ge 100<br \/>\n\\end{cases}<br \/>\n$<\/span><\/p>\n<p>We can make a plot of this function to see how it changes as a function of $n$:<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat.png\" alt=\"\" width=\"1487\" height=\"1001\" class=\"aligncenter size-full wp-image-2615\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat.png 1487w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat-300x202.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat-768x517.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat-1024x689.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2018\/12\/elf_song_repeat-1200x808.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>As expected, the probability remains at or near $1$ for awhile, and then drops once the number of songs on the playlist gets very large. Searching near $p=0.5$ as stated in the problem, the closest candidate $n$ values are:<br \/>\n\\begin{align}<br \/>\nn=7174\\quad&#038;\\implies\\quad p=0.50002836 \\\\<br \/>\nn=7175\\quad&#038;\\implies\\quad p=0.49997983<br \/>\n\\end{align}The closest to $p=0.5$ is attained by $n=7175$, so we&#8217;ll go with that!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This holiday-themed Riddler problem is about probability: In Santa\u2019s workshop, elves make toys during a shift each day. On the overhead radio, Christmas music plays, with a program randomly selecting songs from a large playlist. During any given shift, the elves hear 100 songs. A cranky elf named Cranky has taken to throwing snowballs at &hellip; <a href=\"https:\/\/laurentlessard.com\/bookproofs\/elf-music\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Elf music&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2615,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[7],"tags":[9,6,8,2],"class_list":["post-2610","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-riddler","tag-binomial","tag-counting","tag-probability","tag-riddler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/comments?post=2610"}],"version-history":[{"count":5,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2610\/revisions"}],"predecessor-version":[{"id":2617,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2610\/revisions\/2617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media\/2615"}],"wp:attachment":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media?parent=2610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/categories?post=2610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/tags?post=2610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}