πŸ“œ ⬆️ ⬇️

Bathroom mosaic and Diophantine equations

It was evening before bedtime. I brushed my teeth and wearily looked at the mosaic in the bathroom. For some reason, I was interested in such a simple fact: if a rectangle of 2 Γ— 3 cells is rounded on both sides with cells, then the stroke area will be the same as the area of ​​the rectangle:




There are exactly as many blue squares as yellow ones. And then I suffered.

I wondered if there are more similar configurations. That is, to a rectangle a timesb draw a contour from two sides, and the contour area coincided with the area of ​​the rectangle. Of course a and b must be whole:



It seems that such cases should no longer be. Blue area a timesb , and yellow - a+b+1 . It is seen that if a or b one, then there will be no coincidence, and if you increase them more 2 times3 , the blue will obviously grow faster. So this configuration is one.


Bored, said the brain. We must weaken the task. So to speak:



But now the task is too weak. In fact, it is necessary to choose two rectangles with integer sides, so that their areas differ exactly by half. And the only restriction on the rectangles is that one can be shoved into the other. There are too many, too boring. Let's go like this:



Fix the width of the edging. Are there many such? Hm Looks more interesting. Yellow Square is (x+a)(x+b)βˆ’ab and we want it to be just ab . That is, we (me and my brain, which has pulled me into this) need to solve the equation:


(x+a)(x+b)βˆ’ab=ab


Or, which is the same:


x2+ax+bxβˆ’ab=0


By this time I was done with my teeth and began to pour the powder into the dishwasher. Aha, said the brain, a good challenge. It is necessary to solve, of course, in integers, that is, this is a Diophantine equation . We did not pass the Diophantine equations at the university, but I remembered something about popular articles about them. Namely:



In this way, for example, the general formula for all Pythagorean triples is easily found. By the way, as with the Pythagorean triples, in our problem any number of multiple solutions. For example, a rectangle 4 times6 You can expand the edging in two squares and so on. Of course, we are interested only in non-multiple decisions.


Will I be able to do all this in my mind, I thought, picking up a humidifier. Algebra without a piece of paper and a computer is a rather insidious thing: mixed up with a minus or forgot some member, and further calculations for nothing. Programmers know what to do to reduce the likelihood of an error - it is necessary to overlap with unit tests. Fortunately, we already know one solution: x=1;a=2;b=3 . We will check it at every step.


12+2 times1+3 times1βˆ’2 times3=0


So far, so good. So, we have a homogeneous equation - all terms are in the second degree. Let's divide the equation by x2 (happening x=0 we are not interested, so it is possible to divide):


1+ fracax+ fracbxβˆ’ fracax times fracbx=0


We make a replacement: p=a/x;q=b/x and we get an equation with two rational variables:


1+p+qβˆ’pq=0


In our unit test p=2;q=3 , the test passes. Now we must draw a straight line. In principle, it can be carried out just through the point (2;3) but it's hard to keep in the brain. But by the method of intent peering, we can easily find another point that satisfies the equation: p=βˆ’1;q=0 . This corresponds to zero area. a timesb and again as a solution is not very interesting, but for holding a straight just right. It’s pretty easy to see that all the lines (except one) going through p=βˆ’1;q=0 described by an explicit equation q= alpha(p+1) (yes, for some reason, the brain issued a Greek letter, although the Latin ones were not yet over). One missing line is p=βˆ’1 She is also not very interesting to us. Of course, any rational point (p;q) where p neqβˆ’1 corresponds to rational  alpha . For example, for the point (2;3) value  alpha=1 . Substitute the equation of a line into our equation and get:


1+p+ alpha(p+1)βˆ’ alphap(p+1)=0


Or


1+p+ alphap+ alphaβˆ’ alphap2βˆ’ alphap=0


Or


1+p+ alphaβˆ’ alphap2=0


Or


 alphap2βˆ’pβˆ’(1+ alpha)=0


In the head it becomes difficult to bring members, the brain desperately asks for a piece of paper. But I lull in the hands of the baby, there is no time for paper. Run the unit test ( p=2; alpha=1 ):


1 times22βˆ’2βˆ’(1+1)=0


Fuf, so far so good. Now we have a quadratic equation for p which actually should give a rational root to any rational  alpha . How can this be, is there a discriminant and all that? Okay, let's try:


D=b2βˆ’4ac=12+4 alpha(1+ alpha)=1+4 alpha+4 alpha2=(1+2 alpha)2


Oh, oh, well, like, a full square came out. Endorphin went to the brain. He, a kind of drug addict, seemed to be seeking this. Here it is the magic of mathematics: a rational number had to come out and work out. We recall the formula for the roots:


p1,2= fracβˆ’b pm sqrtD2a


Or in our notation:


p1= frac1βˆ’(1+2 alpha)2 alpha=βˆ’1


p2= frac1+(1+2 alpha)2 alpha= frac1+ alpha alpha


p1 - this is our pivot point βˆ’1 it is not interesting to us. Our solution is p2 . Substituting it into q= alpha(p+1) we get the answer:


p= frac1+ alpha alpha;q=1+2 alpha


That is, you just need to sort out all the rational fractions as  alpha and for them we get all rational solutions of the equation 1+p+qβˆ’pq=0 (well, except for some that are not very interesting to us).


Of course, it is easier to sort integers, not rational ones. Soldering the baby simethicone, I substitute  alpha=m/n and get:


p= frac1+ fracmn fracmn= fracn+mm


q=2+ fracmn= fracn+2mn


(God, brain, why did you choose m and n ? They are so easily confused in the head! Are there few letters?) In our unit test, if  alpha=1 then fit m=n=1 and it's easy to make sure the test passes.


How do we get back to integers? Remember that we replaced p=a/x;q=b/x . So, we must take for x any number multiple to a common denominator from formulas above. In particular, fits just mn . As a result, we have:


x=mn;a=mn+n2;b=mn+2m2


It is seen that if m and n not mutually simple, then the solution will be a multiple of their common divisor, so we are only interested in mutually simple m and n . The multiple solution will also work if n will be even. In fact let n=2nβ€² . Then


x=2mnβ€²;a=2mnβ€²+4nβ€²2;b=2mnβ€²+2m2


If you divide everything by two, we get


x=mnβ€²;a=mnβ€²+2nβ€²2;b=mnβ€²+m2


This solution is symmetrical to the first, which is quite logical: after all, the problem is symmetric with respect to a and b . Thus, we are interested in mutually simple m and n , and n is odd.


Conveniently, that expression for x It turned out so simple. So, we have an easy way to find all non-multiple solutions for a predetermined width of the edging. x : these are rectangles a=x+n2;b=x+2(x/n)2 where n any odd divider x mutually simple with x/n . The next rectangle will be for x=2;n=1;m=2;a=3;b=$1 :



Both the blue and yellow parts contain exactly 30 cells!


Let's see what else there are solutions for small ones. x ( a and b I rearranged in some places to go up):


xnmarea without edgingsquare with edging
oneoneone2 Γ— 3 = 63 Γ— 4 = 12
2one23 Γ— 10 = 305 Γ— 12 = 60
3one34 Γ— 21 = 847 Γ— 24 = 168
33one5 Γ— 12 = 608 Γ— 15 = 120
fouronefour5 Γ— 36 = 1809 Γ— 40 = 360
fiveonefive6 Γ— 55 = 33011 Γ— 60 = 660
fivefiveone7 Γ— 30 = 21012 Γ— 35 = 420
6one67 Γ— 78 = 54613 Γ— 84 = 1092
63214 Γ— 15 = 21020 Γ— 21 = 420

With these works in mind, the brain again achieved a dose of endorphin. How beautiful and wonderful dividers flow from one number to another! Take for example 6 times55 : the first is divisible by 6, and the second by 11. We add the five to both numbers, and the miracle is now the first is divisible by 11, and the second is by 6. And such tricks in every line! And then the son seemed to calm down. Eleven in the evening, you can go to bed.


Perhaps this can all be considered easier. Perhaps my reasoning was somewhere inaccurate. Perhaps these numbers and works have some special name. I do not know - not looking. I am more interested in this: I am just occupying my mind with such nonsense, or you, too, are suffering are you enjoying? Will they cure us?


')

Source: https://habr.com/ru/post/350640/


All Articles