These fields are all optional and need only
be supplied if you would like a direct reply.
Subject
Your email address
Your real name
You must answer this!
If you don't, my spam filtering will
ensure that I never see your email.
What's 8 plus five (in digits only)?
Please make your changes here and then
Editing tips and layout rules.
File: RationalRepeats ''' <link rel="alternate" type="application/rss+xml" ''' href="/rss.xml" title="RSS Feed"> ********> width="25%" |>> ''' <a title="Subscribe to my feed" ''' rel="alternate" ''' href="https://www.solipsys.co.uk/rss.xml"> ''' <img style="border-width: 0px;" ''' src="https://www.feedburner.com/fb/images/pub/feed-icon32x32.png" ''' align="middle" ''' alt="" />Subscribe!</a> _ ''' <a href="https://twitter.com/ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/new/images/TwitterButton.png" ''' title="By: TwitterButtons.net" ''' width="212" height="69" ''' alt="@ColinTheMathmo" ''' /></a> <<| ---- My latest posts can be found here: * ColinsBlog ---- Previous blog posts: * WhyIsItLovely * CompilingCryptoConnections * ExploringConnectionsBetweenCryptoSystems * ElwynBerlekampHasLeftUs * RootCauseAnalysisAndThePhotocopierQuestion * TheUpDownTides * TheForeAftTide * TheSidewaysTide * WrappingUpWrappingUpTheEarth * TheOtherWrappingTheEarthProblem * WrappingTheEarth * TheRingOfSteel * RoundingUpTheRopes * OtherOtherOtherRopeAroundTheEarth * RopeAroundTheEarthRefined * TheOtherRopeAroundTheEarth * ElementaryEstimates * LatitudeCorrection * JustGiveMeTheAnswer * MoreMusingOnPollardRho * IdleThoughtsAboutPollardRho * WhenOptimisingCodeMeasure * ADogCalledMixture * AnotherPayPalScam * WhyTopPostingHasWon * UnexpectedInteractionOfFeatures * ArchimedesHatBoxTheorem * ConsideringASphere * ToLinkOrNotToLink * GenericAdviceForWritingAThesis * JustTeachMyChildTheMaths * NotASpectatorSport * LeftTruncatablePrime * TheDoctorAndTheLawyer * FourPointsTwoDistancesProof * MeetingRonGraham * NapkinRingVersusSphericalCap * TheFourPointsPuzzle * RadiusOfTheEarthPartTwo * GrepTimingAnomaly * TheRadiusOfTheEarth * ThisWorksToCureMyHiccoughs * PerhapsWeSavedOne * ThinkingAboutMastodon * DisappearingTrainsOnVirgin * TheIndependenceGame * OneOfMyFavouritePuzzles * ThinkingAboutRecursion * MemorisingTheTube * SpikeySpheres * SurprisinglyQuick * AnUnexpectedFraction * YouHaveToAdmireTheirOptimism * RepresentativesMatter * PythagorasByIncircle * APuzzleAboutPuzzles * HowNotToDoTwitter * Calculating52FactorialByHand * SmallThingsMightNotBeSoSmall * NotIfYouHurry * FactoringViaGraphThreeColouring * AnotherProofOfTheDoodleTheorem * WhenObviousIsNotObvious * GraphThreeColouring * TheDoodleTheorem * BeCarefulWhatYouSay * TheMutilatedChessboardRevisited * AMirrorCopied * TheOtherOtherRopeAroundTheEarth * PhotocopyAMirror * ThePointOfTheBanachTarskiTheorem * SieveOfEratosthenesInPython * FastPerrinTest * RussianPeasantMultiplication * FindingPerrinPseudoPrimes_Part2 * FindingPerrinPseudoPrimes_Part1 * TheUnwiseUpdate * MilesPerGallon * TrackingAnItemOnHackerNews * HackerNewsUserAges * PokingTheDustyCorners * ThereIsNoTimeForThis * PublicallySharingLinks * LearningTimesTables * GracefulDegradation * DiagrammingMathsTopics * OnTheRack * SquareRootByLongDivision * BeyondTheBoundary * FillInTheGaps * SoftwareChecklist * NASASpaceCrews * TheBirthdayParadox * TheTrapeziumConundrum * RevisitingTheAnt * TheAntAndTheRubberBand * IrrationalsExist * MultipleChoiceProbabilityPuzzle * RandomEratosthenes * WrappingUpSquareDissection * DissectingASquarePart2 * DissectingACircle * DissectingASquare * AnOddityInTennis * DecisionTreeForTennis * DecisionTreesInGames * AMatterOfConvention * DoYouNourishOrTarnish * BinarySearchReconsidered * TwoEqualsFour * TheLostPropertyOffice * TheForgivingUserInterface * SettingUpRSS * WithdrawingFromHackerNews ---- Additionally, some earlier writings: * RandomWritings. * ColinsBlog2010 * ColinsBlog2009 * ColinsBlog2008 * ColinsBlog2007 * ColinsBlogBefore2007 ******** [[[> This page has been _ TaggedAsMaths ]]] !! Repeating decimal expansions - 2019/05/09 Recently on-line I saw someone talking about the decimal expansion of pi, and they said: ********> width="10%" ******** width="80%" [[[ In normal base 10 numbering ... 3.14159265358979... The three dots at the end signal that this series goes on for ever - it is infinite. A second claim is made that the series is ever-changing and never repeats. I describe that as a claim because I can't see how it can be proved ]]] ******** width="10%" ********< We had a bit of a discussion, and I thought it would be worth putting down a few thoughts, aimed at people who are intrigued, but who have absolutely no mathematical background (or at least, none of which they are confident). I might not succeed, probably won't, but here are some basic concepts to help people get a start at seeing how and why these things work. In this post I'm going to show that we have the following: * There are two kinds of numbers: * those for which the decimal expansion eventually repeats, and * those for which the decimal expansion does not repeat. Well, that doesn't seem like it requires much proof. Either something does or does not eventually repeat. Next, I'm going to show this: * There are numbers that: * can be expressed as the ratio of two "whole numbers" * (by which I mean numbers such as -3, -2, -1, 0, 1, 2, 3, etc.), and there are numbers that * *cannot* be expressed as the ratio of two whole numbers. It's pretty clear that there are numbers that can be expressed as a ratio, I can simply exhibit some: $\frac{2}{3}$ is one, $\frac{-7}{4}$ is another, for example. What is perhaps less clear is that there are numbers (whatever we mean by that) that *cannot* be written as the ratio of two whole numbers. We'll get to that. The third, and most marvellous thing is this: * The numbers whose decimal expansions eventually repeat are exactly those numbers that can be written as a ratio of two whole numbers. This will be a long post because I'm going to take it gently. I hope it will be an easy read, but don't be seduced into thinking the ideas are easy. There are some very deep things going on here, so every now and again you may have to back up and re-read something from earlier. Let's start by evaluating some fractions, some ratios, and make some observations. Firstly: * $\frac{1}{8}$ evaluates to 0.125 * $\frac{5}{2}$ evaluates to 2.5 These don't look like they go on forever, I know, but for the sake of consistency I want to include the infinite trailing zeroes that are implicitly there. So actually these are: * $\frac{1}{8}$ evaluates to 0.1250000... * $\frac{5}{2}$ evaluates to 2.5000000... We are also fairly familiar with these: * $\frac{1}{3}$ evaluates to 0.3333333... * $\frac{7}{6}$ evaluates to 1.1666666... We're pretty happy that these (a) go on forever, and (b) repeat. In the second case the repeat is "eventual" - it doesn't start repeating immediately after the decimal point. Other examples of that might be: * $\frac{17}{120}$ evaluates to 0.14166666666... * $\frac{51}{88}$ evaluates to 0.57954545454... So far all these ratios have been repeating, possibly eventually, and possibly trivially, but certainly repeating. So questions that naturally arise: * Is this always true? * How do you know? !! It's always true. [[[>50 A few comments: * The technical term for what we're calling "whole numbers" is "integer"; * The integers include the negative numbers; * We're assuming that we're not dividing by zero. ]]] The claim is that every time we have a ratio, a fraction, a division of one whole number by another, then the result is always a repeating decimal (possibly trivially). How can we prove that? One way to think about division is to ask: "How many bunches of 7 can we make from 178 things?" We can just subtract off 7 repeatedly and see how many times we could do that (25, with 3 left over), but we can do it more efficiently by a technique called "chunking". We remove a chunk of 7s all at once, and keep track of those lumps. [[[>50 This will feel needlessly complicated, but stick with it for a moment - perhaps skim and come back later. ]]] We start by working in 10s. How many tens of 7 can we remove from 178? We can remove 2 lots of 10s of 7. In other words, we can remove 20 lots of 7. That's 140, which we remove from 178, leaving a remainder (so far) of 38. Now let's work in 1s. How many 1s of 7 can we remove from 38? We can remove 5 lots of 1s of 7. In other words, we can remove 5 lots of 7. That's 35, which we remove from 38, leaving a remainder (so far) of 3. Now let's work in tenths. Our remainder is 3, which is 30 tenths. How many tenths of 7 can we remove from 30 tenths? We can remove 4 lots of tenths of 7. In other words, we can remove 4 lots of tenths of 7 from 30 tenths, leaving 2 tenths. [[[>50 The much maligned algorithm that everyone loves to hate on - long division - is exactly this process done efficiently and in tabular form. ]]] Then we can work in hundredths, and so on. At each stage we have a remainder, and we can continue. If that remainder is ever zero then the process stops, but otherwise it goes on forever. So at every stage we take away some sevens and are left with a remainder, and the stream of digits in the result is, at each stage, determined by that remainder. But the remainders must always be less than seven, otherwise we could have removed more of them. As a result, eventually the remainder will be the same as one we've seen before, and at that point the process goes into a cycle. So when we do a division, unless it "goes exactly" (which has the remainder of zero somewhere) the digits we get must eventually repeat, and will then do so forever. Thus we have shown that the decimal expansion of a fraction always repeats. !! But wait - there's more! [[[>50 Note: There is some *very* deep and *very* cool number theory in the obvious question "What will the period length be?" I'm most *definitely* not going to go into that here. Maybe another time. ]]] When dividing by 7 there are only 6 possible remainders, so the length of the repeat must be no more than 6. You can see that by doing some examples with 13, 14, 15, etc. The length of the repeat will always be less than the number you're dividing by: * $\frac{3}{13}$ gives a repeat length of 6; * $\frac{3}{11}$ gives a repeat length of 2; * $\frac{3}{7}$ gives a repeat length of 6; * $\frac{1}{6}$ gives a repeat length of 1; So every fraction, when expressed as a decimal, is always a repeating decimal, although possibly trivially (being all zeroes) and possibly only after an initial period of non-repeating digits. !! What about the converse? So if every fraction is a repeating decimal, is every repeating decimal necessarily expressible as an exact fraction? Yes. Let's see how to do that. Here we'll demonstrate the process with a specific example, but the process will work with any number. Take some repeating decimal: * 8.238636363636363... This starts with 8.238 and then we have "63" repeated endlessly. To start, we multiply up by a power of ten that is enough to have only the repeats after the decimal point. In this case there are three initial digits after the decimal point, so we'll multiply up by 1000. At the end, whatever answer we get, we'll divide out by that 1000 to put things back the way they were. So now we have this: * 8238.636363636363... OK, subtract off the integer part, which is 8238, to leave us with: * 0.636363636363... That's a bit bigger than 0.63 which is $\frac{63}{100}$, so we want to divide 63 by something a little smaller than 100. Let's try 99: * $\frac{63}{99}$ gives us what we want: 0.636363636363... [[[>40 I am well aware that this is a bit "rabbit from a hat". This process really does work, and it's not hard to prove, but it will take a post at least as long as this to do it carefully. ---- You don't need to bother with these final manipulations, as we already have our target number as the result of additions, multiplications, and divisions, so the result must be expressible as a fraction. But feel free to check and follow along for completeness. ]]] And this works in general. Look at the length of the repeat, then put the repeating bit over that many 9s. Our repeat is of length 2, so we put 63 over 99. So our fraction is $8238+\frac{63}{99}$ divided by 1000. The final form is: * $\frac{8238\times{99}+63}{99000}$ or $\frac{815625}{99000}$ That can then be reduced to lowest terms, giving $\frac{725}{88}$. This process works for every repeating decimal, although the proof will have to wait for another day. However, assuming it does work, and it certainly seems to with the examples to hand, we have shown that every repeating decimal can be written as a fraction, a ratio of whole numbers. !! Taking stock ... So we have shown that every fraction can be expressed as a repeating decimal, and every repeating decimal can be expressed as a fraction. That means that a number that never repeats is not a fraction, it's not a ratio. Thus we have: * A number that does not eventually repeat is irrational. * An irrational number when expressed as a decimal never repeats. Still to do (in some order): * A new(ish) proof that $\sqrt{2}$ is irrational, and hence never repeats; * A proof that the "divide by 99" trick always works; * A proof that $e$ is irrational, and hence never repeats; * A proof that $\pi$ is irrational, and hence never repeats; * The difference between "irrational" and "transcendental". And possibly more. ---- |>> | |>> <<<< Prev <<<< ---- WhyIsItLovely <<| | : | |>> >>>> Next >>>> ---- NonRepeatingDecimals ... <<| | ---- ********> ''' <a href="https://mathstodon.xyz/@ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/images/Mastodon_Mascot.png" ''' width="256" height="280" ''' alt="https://mathstodon.xyz/@ColinTheMathmo" ''' /></a> ******** ''' <a href="https://mathstodon.xyz/@ColinTheMathmo/">You can follow me on Mathstodon.</a> _ _ _ _ [[[> ''' <a href="https://twitter.com/ColinTheMathmo">Of course, you can also<br>follow me on twitter:</a> ''' <a href="https://twitter.com/ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/new/images/TwitterButton.png" ''' title="By: TwitterButtons.net" ''' width="212" height="69" ''' alt="@ColinTheMathmo" ''' /></a> ''' <img src="/cgi-bin/CountHits.py?RationalRepeats" alt="" /> ]]] ********< ---- !! Send us a comment ... ''' <form action="https://www.solipsys.co.uk/cgi-bin/FormMail.pl" method=post> ''' <input type=hidden name="recipient" value="colinsblogcomment@solipsys.co.uk" > ''' <input type=hidden name="subject" value="Blog comment : RationalRepeats" > ''' <input type=hidden name="redirect" value="https://www.solipsys.co.uk/new/ThankYouForYourComment.html" > ''' <input type=hidden name="missing_fields_redirect" value="https://www.solipsys.co.uk/RequestError.html"> ''' <input type=hidden name="env_report" value="REMOTE_HOST, REMOTE_ADDR, HTTP_USER_AGENT" > ''' <input type=hidden name="print_blank_fields" value="1" > ********> width="47%" You can send us a message here. It doesn't get published, it just sends us an email, and is an easy way to ask any questions, or make any comments, without having to send a separate email. So just fill in the boxes and then ''' <font size="+4"><INPUT TYPE="submit" VALUE="CLICK HERE TO SEND"></font> ******** width="53%" ********< ''' <table cellpadding="5"> ''' <tr> ''' <td valign="top">Your name </td> <td valign="top">:</td> ''' <td> <input type=text name="realname" size="48"> </td> ''' <tr> ''' <td valign="top">Email </td> <td valign="top">:</td> ''' <td> <input type=text name="email" size="48"> </td> ''' </tr> ''' <tr> ''' <td valign="top">Message </td> <td valign="top">:</td> ''' <td> <TEXTAREA NAME="Message" ROWS=10 COLS=64></TEXTAREA> </td> ''' </tr> ''' </table> ''' <center> ''' <font size="+4"> ''' <INPUT TYPE="submit" VALUE="CLICK HERE TO SEND"> ''' </font> ''' </center> ''' </form> ********<