Processing math: 100%
Skip to main content

Calkin-Wilf Tree

I gave this talk at CMI STEMS final camp 2024.

Definitions

Before proceeding, we must be clear about what our title means.

What do you mean by Counting?

What do we mean by the term counting? We are going to prove that Rational numbers are countable. That is, there is a bijection between natural numbers and rational numbers.
A bijective function f:X\rightarrow Y is a one-to-one (injective) and onto (surjective) mapping of a set X to a set Y.
Note that every bijection from set X to a set Y also has an inverse function from set Y to set X. But how are we going to create the bijection? We will first create a bijection between the Natural numbers and Positive rationals. Let f(1),f(2),\dots be the mapping from natural numbers from \Bbb{N}\rightarrow +\Bbb{Q}. Then, note that there is also a bijection from \Bbb{N}\rightarrow -\Bbb{Q} by simply mapping i\in \Bbb{N}\rightarrow -f(i). And to create the bijection from g:\Bbb{N} \rightarrow \Bbb{Q}, consider \begin{equation} g(n)= \begin{cases} f(k) & \text{if } n=2k, k\in \Bbb{N}\\ -f(k) & \text{if } n=2k+1, k\in \Bbb{N}, k>1\\ 0 & \text{if } n=1 \end{cases} \end{equation}
Great! So we know how to create a bijection between \Bbb{N}\rightarrow\Bbb{Q} if we are given the bijection between \Bbb{N}\rightarrow+\Bbb{Q}. But how can we create the bijection between \Bbb{N}\rightarrow+\Bbb{Q}? We use the Cute tree!

Cute tree

Every node of this binary tree is assigned a positive fraction.And the starting node is \frac{1}{1}. If the positive fraction is \frac{p}{q}, then we define it's left child as \frac{p}{p+q} and the right child as \frac{p+q}{q}. We call the fraction \frac{p}{q} as the parent of \frac{p}{p+q} and \frac{p+q}{q}.

Introduction

In general, if we have the fraction as x, then note that it's left child is \frac{x}{x+1} and the right child is x+1. However, before proceeding, we shall prove this.
If the parent is x, then it's left child is \frac{x}{x+1} and the right child is x+1.
Let x=\frac{p}{q}. Then by definition, \text{ the right child is }\frac{p+q}{q}=\frac{p}{q}+1=x+1.
And by definition, \text{ the left child is }\frac{p}{p+q}=\frac{1}{\left(\frac{p+q}{q}\right)}\cdot \frac{p}{q}=\frac{x}{x+1}.

Infinite cute tree

We start with \frac{1}{1} and proceed to make the left child and right child. Note that this process is infinite and hence the name.
\vdots
Define the 1st row has 1/1. The second row has childs of 1/1. The n+1st row is the row which has childs of nth row fractions.

Some properties

Here are a few properties of the infinite cute tree which we will proceed to prove in the talk.
Every positive rational number appears in the tree and appears uniquely on the tree.
Assuming this proposition is true, we can simply number every node in every row systematically. But how are we numbering? Start numbering from the first row and then number starting from the right side of the next row and continue. We get f(1)\rightarrow \frac{1}{1}
f(2)\rightarrow \frac{1}{2}
f(3)\rightarrow \frac{2}{1}
f(4)\rightarrow \frac{1}{3}
f(5)\rightarrow \frac{3}{2}
\vdots
All the fractions in the infite cute tree are in reduced form.
We can prove this using induction.
If \frac{p}{q} is reduced then so is \frac{p}{p+q},\frac{p+q}{q}.
Note that (p,q)=1\implies (p+q,p)=1,(q,p+q)=1\implies \frac{p}{p+q},\frac{p+q}{q}\text{ are in reduced form if }
\frac{p}{q}\text{ is in reduced form }. Clearly elements of row 1 are reduced. Say elements are reduced for kth row. Then by our above claim, we get that k+1th row is reduced, and by induction, we are done.
The left child of any vertex is always strictly less than 1.
Let \frac{p}{q} is the parent, then the left child is \frac{p}{p+q} which is less than \frac{p}{p}=1.
For example, the left child of \frac{20}{23} is \frac{20}{43} which is less than 1.
The right child is always strictly greater than 1.
Let \frac{p}{q} is the parent, then the right child is \frac{p+q}{q} which is greater than \frac{q}{q}=1.
For example, the right child of \frac{20}{23} is \frac{43}{23} which is greater than 1.
Every vertex is the product of its childs.
For any node, the childs are \frac{p}{q} are \frac{p}{p+q} and \frac{p+q}{q}. And the clearly, the product of the children are \frac{p}{p+q}\times \frac{p+q}{q}= \frac{p}{q}.

Cool sequence Algorithm

This algorithm can be used to find the unique path from any given reduced fraction to 1/1. Moreover, this algorithm also proves proposition. \begin{equation} \text{For any fraction } a/b, \text{ the parent is} \begin{cases} a/b-a & \text{if } b>a\\ a-b/b & \text{if } a>b \end{cases} \end{equation}
For example, take any fraction, \frac{13}{47} then the parent of \frac{13}{47} is \frac{13}{34}. We will now trace it back to 1/1 as all fractions originate from 1/1. So we have 13/47\rightarrow 13/34\rightarrow 13/21\rightarrow13/8 \rightarrow5/8\rightarrow5/3\rightarrow 2/3\rightarrow2/1\rightarrow1/1.
Let Cool sequence path denote the path which take any fraction p/q to 1/1.
Note that for any fraction which appears in the tree will have a unique parent and hence a unique cool sequence path. Hence, any fraction appearing in the cute tree appears only once. Now, we claim that any reduced fraction appears on this tree. However, note that our algorithm works for any reduced fraction.

More Properties

Number of elements in nth row is 2^{n-1}.
We can prove this by induction. The base case is true. Suppose it's true for kth row, then by definition of k+1th row, the k+1th row will contain childs of kth row. Note that these childs will be unique and distinct by the first proposition, we get that the number of elements in the k+1th row is 2 times the number of elements in the kth row, which by induction is 2^{k-1}. And we are done.
The ith node from the left in any given row is the reciprocal of ith vertex from the right of the tree of that row.
We proceed with induction. True for the first row. Say it is true for the kth row. Then say the ith node from the left is p/q and the ith node from the left is q/p. Then we consider the children. The right child of p/q is the 2i-1th from left in row k+1 and the left child of q/p is the 2i-1th from right in row k+1. However, The right child of p/q is p/p+q and the left child of q/p is q+p/p, and both are reciprocal of each other. Similarly, the left child of p/q and the right child of q/p are the 2ith element from left and right, respectively, in row k+1. And the left child of p/q is p/p+q and the right child of q/p is p+q/p, which are clearly reciprocal of each other. And our hypothesis is true for k+1th row. So, we are done by induction!
The product of all the elements in a given row is 1.
True for the first row. For any k>1th row, we get that there are even number of elements. Using the above proposition, we get that every ith element from the left can be paired with the ith element from the right. Note that both these elements are reciprocal of each other, and hence the product of them is 1. And hence the product is 1.
The 1st node from the left in nth row is 1/n and the 1st node from right in nth row is n/1.
True for the first row. Say it is true for the kth row. Then the leftest node must be 1/k and rightest node is k/1. Note that the leftest node in the k+1th row is the left child of the leftest node in kth row. Hence it must be 1/(k+1). Similarly, we get that the rightest node in the k+1th row is the right child of the rightest node in kth row. Hence it must be (k+1)/1.
Sum of all elements in nth row is 3\cdot 2^{n-2}-\frac{1}{2}.
We proceed with induction. It is true for n=1 row. Say it's true for kth row. Now consider the k+1 row. For any fraction, we know it's reciprocal is there. So for a/b in the kth row, we know that b/a is there too. We consider the children which are in the k+1th row and the sum. So we get a/(a+b)+(a+b)/b+b/(a+b)+(a+b)/a= 3+a/b+b/a.
Hence, we get the sum of elements in k+1th row is 3\times 2^{k-2}+3\cdot 2^{k-2}-\frac{1}{2}=3\times 2^{k-1}-\frac{1}{2}.
And we are done by induction.

Binary preimage

Using our cool sequence algorithm, we showed that our function f covers all positive rational numbers uniquely. Now, we will show that given any fraction, how we can find its preimage (which is obviously unique). Remember our Cool sequence algorithm? We will do the same thing, except now we will also care about the left and right child. For example, we know that 13/47 is leftchild of 13/34 and so on. So we get \frac{13}{47}\overset{\text{L}}{\rightarrow} \frac{13}{34}\overset{\text{L}}{\rightarrow} \frac{13}{21}\overset{\text{L}}{\rightarrow}\frac{13}{8} \overset{\text{R}}{\rightarrow}\frac{5}{8}\overset{\text{L}}{\rightarrow}\frac{5}{3}\overset{\text{R}}{\rightarrow}\frac{2}{3}\overset{\text{L}}{\rightarrow}\frac{2}{1}\overset{\text{R}}{\rightarrow}\frac{1}{1}.
We define a new function, g(n) which is basically the same as f(n) but we define g(n) as the following.
Note that f(n)=g(2^{\log_2(n)}+2^{\log_2(n)+1}-1-n).
Note that if the number g(n) is the parent, then its right child is g(2n) and the left child is g(2n+1). Now consider Now, consider the binary representation of n,2n and 2n+1. If the n=(a_1a_2\dots a_k)_2 then note that 2n=(a_1\dots a_k0)_2 and 2n+1=(a_1\dots a_k1)_2. So we add 1 at the end of the binary reprsentation whenever we go to the left child and 0 if right. Hence, for the above example, we start with 1/1. Since 2/1 is right child, we add 1 to binary expression. Hence (11)_2. And we proceed like this. We get that 13/47=g((110101000)_2)=g(424)=f(512+256-1-424)=f(343).
Note that, using our above results, we get that there is a bijection between naturals and positive rationals. And hence by our discussion in \textbf{section 1.2}, we get that there is a bijection between naturals and rational numbers. Hence, rationals are countable.

Connection with Euclidean algorithm

We consider 13/47 as the example. Recall, we had \frac{13}{47}\overset{\text{L}}{\rightarrow} \frac{13}{34}\overset{\text{L}}{\rightarrow} \frac{13}{21}\overset{\text{L}}{\rightarrow}\frac{13}{8} \overset{\text{R}}{\rightarrow}\frac{5}{8}\overset{\text{L}}{\rightarrow}\frac{5}{3}\overset{\text{R}}{\rightarrow}\frac{2}{3}\overset{\text{L}}{\rightarrow}\frac{2}{1}\overset{\text{R}}{\rightarrow}\frac{1}{1}.
Note that 47=3\times 13+8\text{ hence three times L}
13=1\times 8+5\text{ hence one time R}
8=1\times5+3\text{ hence one time L}
5=1\times 3+2\text{ hence one time R}
3=1\times 2+1\text{ hence one time L}
2=2\times 1+0
Note that at every step, our L,R are alternating. This is because if a=qb+r was say L, then that implies the fraction was b/a and then after qL's we get to b/r, but we have b>r by euclidean algorithm. So we get that b/r must be a right child. Hence they are alternating. Moreover, whenever we get the equation of the form n=n\times 1+0 at the end of the euclidean algorithm ( note that we are supposed to get this as the fractions are in reduced form), we write n-1 times the symbol. Hence, for our current example, we have n-1=2-1=1 times R. Since we can connect euclidean algorithm and finite continued fractions, we can also connect the fractions with finite continued fractions.

Address formula

Using the binary preimage, we can now figure out the actuall address for any fraction. For any fraction a/b, we figure out the n such that f(n)=a/b. The the row f(n) belongs to is {[\log_2(n)]}+1 as in the kth row, f(2^{k-1}),\dots, f(2^{k}-1) are there. And then the fraction would be n-2^{[\log_2(n)]}th element from left.

Algebraic formula

We claim the following.
We have the following recursive formula f(n+1)=\dfrac{1}{[f(n)]+1-\{f(n)\}}
with f(1)=1/1=1.
We firstly simplify the formula.
Note that f(n+1)=\dfrac{1}{[f(n)]+1-\{f(n)\}}=\dfrac{1}{2[f(n)]+1-f(n)}.
As we have f(n)=[f(n)]+\{f(n)\}, we get that [f(n)]+1-\{f(n)\}=[f(n)]+1-(f(n)-[f(n)])=2[f(n)]+1-f(n).
Note that for any fraction f(n+1) where f(n+1) is the left child, we can say that f(n+1)=\dfrac{1}{[f(n)]+1-\{f(n)\}}.
For any fraction f(n+1) where f(n+1) is the left child, we can say that f(n+1)=\dfrac{1}{2[f(n)]+1-f(n)}
We get that the left child is f(n)=\frac{x}{x+1} and right child is f(n+1)=x+1 for any vertex x. We have to show that \dfrac{1}{2[f(n)]+1-f(n)}=f(n+1)
or show that 2f(n+1)[f(n)]+f(n+1)-f(n)f(n+1)=1.
But note that f(n) is a left child, so we get that 2f(n+1)[f(n)]=0. Moreover, we get that f(n+1)-f(n)f(n+1)=x+1-x=1.
And we are done!
So our theorem holds true whenever f(n) is a left child. Now, we see the case when f(n) is the right child. Since f(n) is the right child, we have f(n+1) is the left child of some other parent. Since all fractions are getting generated by 1/1, the fraction f(n),f(n+1) must have same parent some rows ago. Let a/b be that common parent fraction k+1 rows. Then note that f(n) is generated by taking k consecutive right childs after one left child from a/b and f(n+1) is generated by taking k consecutive left child after one right child from a/b. Now, before proceeding further, we present a lemma.
For any number x = p/q, the rightmost child after n rows is (p + nq)/q = x + n, and the leftmost child is p/(np + q) = x/(nx + 1).
The proof is just induction. It is true for n=1 case. Say it is true for n=k. Then note that the right child of rightmost child in kth row is rightmost child in k+1th row. And right child is (p+(k+1)q)/q=x+k+1. And similarly for left child. And we are done by induction.
The left child of a/b is a/(a+b) and right child is (a+b)/b. As f(n) is is generated by taking k consecutive right childs after one left child from a/b, by above lemma, we have f(n)=a/(a+b)+k
and we have f(n+1)=[(a+b)/b]/[k(a+b)/b+1]
=(a + b)/(k(a + b) + b)=1/(k + b/(a+b)).
Now, note that [f(n)]=k. And hence we have f(n)-k=a/(a+b)\implies f(n)-[f(n)]=a/(a+b).
So note that f(n+1)=\frac{1}{1-a/(a+b)+k}=\frac{1}{1-f(n)+2k}=\frac{1}{1-f(n)+2[f(n)]}.
Hence, we prove for the right child too. I hope you liked reading it!

Comments

Post a Comment

Popular posts from this blog

Solving Random ISLs And Sharygin Solutions! And INMO happened!!

Some of the ISLs I did before INMO :P  [2005 G3]:  Let ABCD be a parallelogram. A variable line g through the vertex A intersects the rays BC and DC at the points X and Y, respectively. Let K and L be the A-excenters of the triangles ABX and ADY. Show that the angle \measuredangle KCL is independent of the line g Solution: Note that \Delta LDK \sim \Delta XBK
and \Delta ADY\sim \Delta XCY.
So we have \frac{BK}{DY}=\frac{XK}{LY}
and \frac{DY}{CY}=\frac{AD}{XC}=\frac{AY}{XY}.
Hence \frac{BK}{CY}=\frac{AD}{XC}\times \frac{XK}{LY}\implies \frac{BK}{BC}=\frac{CY}{XC}\times \frac{XK}{LY}=\frac{AB}{BC}\times \frac{XK}{LY}
\frac{AB}{LY}\times \frac{XK}{BK}=\frac{AB}{LY}\times \frac{LY}{DY}=\frac{AB}{DL}
\implies \Delta CBK\sim \Delta LDK
And we are done. We get that \angle KCL=360-(\angle ACB+\angle DKC+\angle BCK)=\angle DAB/2 +180-\angle DAB=180-\angle DAB/2
Motivation: I took a hint on this. I had other angles but I did...

Some problems in Olympiad Graph theory!

Hello there! It has been a long time since I uploaded a post here. I recently took a class at the European Girls' Mathematical Olympiad Training Camp 2024, held at CMI. Here are a few problems that I discussed! My main references were Po-Shen Loh's Graph theory Problem set (2008), Adrian tang's Graph theory problem set (2012) and Warut Suksompong's Graph Cycles and Olympiad Problems Handout and AoPS. I also referred to Evan Chen's Graph theory Otis Problem set for nice problems! Text Book Problems which are decent A connected graph G is said to be k-vertex-connected (or k-connected) if it has more than k vertices and remains connected whenever fewer than k vertices are removed. Show that every k-connected graph of order atleast 2k contains a cycle of length at least 2k. We begin with a lemma. Prove that a graph G of order n \geq 2k is k connected then every 2 disjoint set V_1 and V_2 of k distinct vertices each, there exist k...

My experiences at EGMO, IMOTC and PROMYS experience

Yes, I know. This post should have been posted like 2 months ago. Okay okay, sorry. But yeah, I was just waiting for everything to be over and I was lazy. ( sorry ) You know, the transitioning period from high school to college is very weird. I will join CMI( Chennai Mathematical  Institue) for bsc maths and cs degree. And I am very scared. Like very very scared. No, not about making new friends and all. I don't care about that part because I know a decent amount of CMI people already.  What I am scared of is whether I will be able to handle the coursework and get good grades T_T Anyways, here's my EGMO PDC, EGMO, IMOTC and PROMYS experience. Yes, a lot of stuff. My EGMO experience is a lot and I wrote a lot of details, IMOTC and PROMYS is just a few paras. Oh to those, who don't know me or are reading for the first time. I am Sunaina Pati. I was IND2 at EGMO 2023 which was held in Slovenia. I was also invited to the IMOTC or International Mathematical Olympiad Training Cam...

Introduction

  Hey Everyone!! This is my first Blog post. So let me give a brief introduction about myself. I am Sunaina Pati. I love solving Olympiad math problems,  learning crazy astronomical facts , playing hanabi and anti-chess, listening to Kpop , love making diagrams in Geogebra and  teaching other people maths 😊 . I love geometry , number theory and Combinatorics . I am starting this blog to keep myself a bit motivated in doing studies 😎 . Right now, I am planning to write walkthroughs on some of the best problems I tried over the week which can refer for hints 'cause solutions contain some major spoilers and one learns a lot while solving the problem on his own rather than seeing solutions . Also, there will be some reviews about Kpop songs, study techniques, my day to day lifestyles,exam reviews and ofc some non-sense surprises 😂.  I am planning to  try  posting every week on Sundays or Saturdays ( most probably) ! Though there is no guarantee about when I ...

Bio is Love..

Adios, everyone! Boards preparation at its peak :(  However, I am not able to study how I used to. Every time I try to study for boards, I just keep thinking much about a topic, stare at the book, jam a song or just start doing procrastination by bookmarking random cute problems in HSO. It's been more than a year I have studied like with a focus on a book. My lappy is being a big distraction tbh. So after INMO score come out, I will just give my lappy for repair and say papa to bring it back home after June 2.  Milk and Mocha I literally am taking 2 days to complete 1 bio chapter, some times even 3. The rate of my "slowness" is probably because I am like every 15 minutes checking discord to see if the INMO scores are out or not. So HBCSE, thank you for keeping me anxious.  Funfact:- we must be grateful that there is an organisation that is conducting these national Olys. There are some countries where no Olys are being conducted. ( Same dialogue which mumma uses, but in p...

New year with a new beginning! And a recap of 2024..and all the best for INMO 2025!

Hi everyone! Happy New Year :)  Thank you so much for 95k+ views!!! How was everyone's 2024? What are everyone's resolutions? ( Do write down in the comment section! And you can come back 1 year later to see if you made them possible!). And.. What about me?  A Better human being Well, I want to become a better human being this year compared to last year. From a very young age, my father has been saying to me, "It does not matter if you are a good mathematician, but you should be a nice human being." As a teenager, I never took the statement seriously. Well, all that mattered to me was to do good mathematically. Why should I care about other people's feelings? These were all my thoughts in high school.  So I ended up saying a few hurtful statements without realising that they were hurtful.  I never actually cared throughout my high school. You know, the world is too big, if I hurt person A, no worries, I will move on to person B and start a new friendship! As a res...

Geometry ( Finally!!!)

 This is just such an unfair blog.  Like if one goes through this blog, one can notice how dominated  Algebra is!! Like 6 out of 9 blog post is Algebra dominated -_- Where as I am not a fan of Algebra, compared to other genres of Olympiad Math(as of now). And this was just injustice for Synthetic Geo. So this time , go geo!!!!!!!!!!!  These problems are randomly from A Beautiful Journey through Olympiad Geometry.  Also perhaps I will post geo after March, because I am studying combi.  Problem:  Let ABC be an acute triangle where \angle BAC = 60^{\circ}. Prove that if the Euler’s line of \triangle ABC intersects AB and AC at D and E, respectively, then \triangle ADE is equilateral. Solution:  Since \angle A=60^{\circ} , we get AH=2R\cos A=R=AO. So \angle EHA=\angle DOA. Also it's well known that H and O isogonal conjugates.\angle OAD =\angle EAH. By ASA congruence, we get AE=AD. Hence \triangle ADE is equilateral....

Let's complex bash Part 1

I have to learn complex bash. And almost everyone knows that I am notes taking girl so thought why not make a post on complex bash ( so that I don't get emotionally demotivated lol).😇 There wasn't any need for learning complex bash, but it was in my dream checklist i.e " To learn a bash." And since I am not loaded with exams, I think it's high time to learn Bash and new topics.  Also if anyone from the "anti-bash" community is reading, sorry in advance and R.I.P.  Notes:- 1. Complex numbers are of the form z=a+ib, where a and b are real numbers and i^2=-1. 2. In polar form, z=r(\cos \theta+~~i\sin\theta)=~~re^{i\theta}, where r=~~|z|=~~\sqrt{a^2+b^2}, which is called the magnitude. 3. Here we used euler's formula i.e \cos \theta+~~i\sin\theta=~~e^{i\theta}. 4. The \theta is called the argument of z, denored \arg z. ( \theta can be considered in \mod 360 and it is  measured anti-clockwise). 5. The complex conjugate of z is ...

How to prepare for INMO

Since INMO is coming up, it would be nice to write a post about it! A lot of people have been asking me for tips. To people who are visiting this site for the first time, hi! I am Sunaina Pati, an undergrad student at Chennai Mathematical Institute. I was an INMO awardee in 2021,2022,2023. I am also very grateful to be part of the India EGMO 2023 delegation. Thanks to them I got a silver medal!  I think the title of the post might be clickbait for some. What I want to convey is how I would have prepared for INMO if I were to give it again. Anyway, so here are a few tips for people! Practice, practice, practice!! I can not emphasize how important this is. This is the only way you can realise which areas ( that is combinatorics, geometry, number theory, algebra) are your strength and where you need to work on. Try the problems as much as you want, and make sure you use all the ideas you can possibly think of before looking at a hint. So rather than fixing time as a measure to dec...

Problems I did this week [Jan8-Jan14]

Yeyy!! I am being so consistent with my posts~~ Here are a few problems I did the past week and yeah INMO going to happen soon :) All the best to everyone who is writing!  I wont be trying any new problems and will simply revise stuffs :) Some problems here are hard. Try them yourself and yeah~~Solutions (with sources) are given at the end! Problems discussed in the blog post Problem1: Let ABC be a triangle whose incircle \omega touches sides BC, CA, AB at D,E,F respectively. Let H be the orthocenter of DEF and let altitude DH intersect \omega again at P and EF intersect BC at L. Let the circumcircle of BPC intersect \omega again at X. Prove that points L,D,H,X are concyclic. Problem 2: Let ABCD be a convex quadrangle, P the intersection of lines AB and CD, Q the intersection of lines AD and BC and O the intersection of diagonals AC and BD. Show that if \angle POQ= 90^\circ then PO is the bisector of \angle AOD ...