## The Two Envelopes Problem

Recently I came across a Youtube video by „vsauce“ explaining the two envelope paradox. The problem is at least half a century old, and most likely a lot older. It can be found in a 1953 book by Maurice Kraitchik which is the oldest citation in Wikipedia.

*Someone places money into one of two identical envelopes and double the money into the second. We select one of the two envelopes without knowing if we have the first or the second one. We open it. Should we keep that money or return it and opt for the other envelope?*

(Let us assume that the value in the first envelope is a rational number. So we cannot conclude with certainty which envelope we have opened. If we selected from integer numbers we would know the envelope in the case of an even value.)

The naive analysis goes like this:

Let X be the amount we have. Since we have chosen the envelopes at random, the other envelope contains X/2 and 2X with the same probability. So our expectation after switching is

\(\dfrac{X/2+2X}{2} = \dfrac{5}{4} X\)

So switching sounds like a winning strategy. It gets more striking if we consider switching before even opening the envelope. Switching back and forth drives the expected value to infinity. This is clearly nonsense.

This paradox is a confirmation of my principle:

*To analyze a probabilistic problem we need an experiment that we could, at least hypothetically, implement in a computer. Equivalently, we need a probability space to work with. *

The two envelopes problem does not satisfy this principle. The reason is that it is impossible to select a rational number at random from the set of all rational numbers. You cannot even select an integer evenly from all the integers. We need a probability distribution for that. Think of how you would test the switching strategy on a computer. You will have to tell the machine how to select a number. It can select a number with equal probability from all the numbers it can represent. But it cannot do so from all, infinitely many numbers.

Now that we know that the original problem makes no sense, we can start to analyze the problem by assuming an a priori distribution for the value M in the first envelope. By doing so, we get a bunch of very interesting questions. (By the way, it is always easy to create questions in mathematics. Only a few questions have nice answers, however.)

Let us start by selecting M evenly from 1 to n. Clearly, we switch if the opened envelope, containing X, is odd. We will keep the money only if X>n. For n which is a multiple of 4, we have the following cases:

- M<=n/2: We will switch no matter if X=M or X=2M. Thus the average outcome is 3/2 M.
- M>n/2: We get 2M in every case.

It is an exercise to compute that our average result is

\(E = \dfrac{15n+14}{16}\)

This is a blog about Euler Math Toolbox too. So let us simulate the strategy in EMT. In this case, a loop would be a good idea, maybe written in C or Python. However, it is also possible to do this elegantly with the matrix language

>n=10; N=1000000; >M=intrandom(N,n); // select a number between 1 and n >sel=intrandom(N,2); // select 1 or 2 envelope >X1=M*sel; X2=M*(3-sel); // X1 is in the selected, X2 in the other >sum((X1>n)*X1+(X1<=n)*X2)/N // X1 for X1>n, X2 else 10.253055 >(15*n+14)/16 // expected outcome 10.25

We could also try a distribution on the positive real numbers for M. A typical candidate is the exponential distribution. We decide ourselves to keep a value greater than some a>0.

In this case, we switch for all M<a/2 and M>a, getting 3/2 M on average. In half of the cases between a/2 and a, we get 2 M. In the other half we still get 3/2 M. Thus

\(E = \dfrac{3}{2}+\dfrac{1}{2} \int\limits_{a/2}^a x e^{-x} \, dx\)

The best choice is a = 4 ln(2) with

\(E \sim 1.68\)

We can simulate that too.

>n=10; N=1000000; >M=randexponential(N); // select a number between 1 and n >sel=intrandom(N,2); // select 1 or 2 envelope >X1=M*sel; X2=M*(3-sel); // X1 is in the selected, X2 in the other >a=4*ln(2); sum((X1>a)*X1+(X1<=a)*X2)/N // X1 for X1>n, X2 else 1.68097393969

Note that switching all the time or never both expect E=3/2.

You might ask if there is a distribution for M which ensures that it does not matter to look inside the first envelope. But that is not the case. Such a distribution does not exist.m Knowing the distribution and looking at the first envelope will always yield an expected overhead for us.

## Two Tilted Rectangles

I found this problem from the wonderful Math with bad Drawings site in my news feed. They cite it from Carolina Shearer. Her twitter account contains more such nice problems. It is the kind of problem which seems only adequate for advanced students. Sometimes, you can solve them by looking at it in the right way. Most of the time, you will start a lengthy computation. Often, you will notice in retrospect that the solution was quite easy and you could have guessed it.

For this problem, I did not see the solution. The problem, of course, is to fit two equal rectangles into a square in the shown manner. For a start, try to find a reason why the point 1/2 on the lower side solves the problem. You can use the general fact that a=b+c in the figure below.

I admit that I did the computations using Euler Math Toolbox. That works. However, there is an elementary fact that can be used to prove a+b=c. For a hint, consult the following image. If the green lines are equal the red lines are equal.

## Euclidea App

Geometry is not as popular nowadays as it was. So I was very surprised to learn about a game that features geometry puzzles. It poses problems of Euclidean geometry in the plane, e.g. constructing the tangent to a circle. To solve the problem fully, goals have to be completed. One goal (L) is to do it with the minimum number of steps with all tools available (which include composite tools like the middle perpendicular). Another goal (E) is to do it with the minimum number of elementary tools, which are circles and lines. The third goal (V) is to construct variations of the solution, like reflections of the solution. The goal (E) is often very difficult even for elementary constructions. I show two examples below.

The app is done by some Russian programmers. I could find no information on the authors at all. Actually, there are lots of Russian programmers that make money with their skills in different areas. Besides gaming, an example is flight simulation where Russia programmers made some of the best addons. The programmers are not necessarily skilled geometry geeks. There are old books buried somewhere in libraries that contain lots of geometry problems and solutions. Those are the reminders of the old times when geometry was still popular.

The app is extremely nicely done and shows dedication and skill with user interfaces. Some details could need perfection and I will talk about that later. The app is free. But you can buy more problems. It is a nice touch that you get these for free if you have solved all the previous goals. However, I am considering to donate to these programmers.

Here is an example of a problem. I present the problem with my own program C.a.R. This program could also pose problems with restricted toolsets, called assignments. However, there is no game feature and I never cared about the number of steps taken. It was a program to help to teach geometry in schools.

Your job is to construct the green line given the black lines. In the app, the given objects are not fat and the user cannot set colors. That makes it more difficult than it should be to keep track of the progress.

Of course, it is quite easy to do the job with two given tools, the line tool, and the perpendicular. Moreover, every geometry student should know the following solution.

It takes 5 elementary steps. It is a typical mathematical solution because it is based on another solution to another problem. Mathematics often does that. We know how to construct the middle perpendicular. Thus we know how to construct a perpendicular to a line through a point on the line. It remains to see the tangent as perpendicular to the radius. But the goal was to do it with three elementary steps, not 5. My second solution was the following.

It takes 4 elementary steps still and is based on another well-known geometry fact, the Thales circle. Observe the brown circle (2) to see why this works. It is still not the optimal solution. I now tell you a secret: You can find all solutions on Youtube. Nowadays, going to Youtube is the first step that students take.

The following is the solution with three steps. Unfortunately, I was given that solution before I could find it. Why it works is by no means obvious.

The only proof I could find is a computation with angles.

By basic equivalences, we get that the angles with equal color are equal. By the circle chord theorem, the angle of a chord of a circle with respect to a point on the circle is half the angle with respect to the midpoint of the circle, thus black=2*blue. We also have black+red=90°. Thus black+2*blue=90°.

There should be a simpler proof to this, but I have not yet found it.

All in all, this is an extremely well-done app. I would like to use colors while constructing. I would also like to use the given segments as lines. This is important in the following example, where you have to construct the center of the inscribed circle with only 6 elementary steps. Note that the usual construction takes 4 elementary steps for each angle bisector.

That is already very complicated. The first step is to construct one angle bisector using the blue circles. The second bisector is found with the mysterious red circle which is constructed by one of the blue circles. Its second intersection with the same blue circle yields the second angle bisector. I found this by trial and error. After all, you can construct the angle bisector in C.a.R. so see where it should be. In the app, you can show the targets too. Did I tall you that you can also find the solution on Youtube?

Does anybody have an easy proof?

## A Geometry Problem

The internet, and especially Youtube, are a vast resource for mathematics now. You find all sorts of problems, explanations, and tutorials, usually done by very talented people. I like to dig around in that pile and soon find some pearls like the following one. The problem has been presented by a guy named Presh Talwalkar. Some of his problems I knew already, but this one was new to me.

The problem is to determine the area of the quadrilateral with the question mark. Of course, no angles or side lengths are given. It took me a while to figure out a simple solution.

The first idea is to put all this in algebraic terms. To make things simpler, we would put the lower-left corner to (0,0) and the lower-right one to (0,a), and the third one to (b,c). The points on the left and right sides of the triangle can then be determined using algebraic geometry (depending on a,b,c) and thus the area in question. This looks tedious but is a really nice exercise. Do not forget the determinant formula for the area of a triangle. Let’s do it!

Euler Math Toolbox (EMT) happens to have a geometry package which can use Maxima to compute symbolically with geometric objects. It turns out to get more involved than expected. Trying to do this by hand seems to be really hard work.

>load geometry Numerical and symbolic geometry. >A &= [0,0]; B &= [a,0]; C &= [b,c]; >P1 &= u*C+(1-u)*A; P2 &= v*C+(1-v)*B; >&solve(areaTriangle(A,P2,B)=6,v), P2v &= expand(P2 with %) 12 [v = ---] a c 12 b 12 12 [---- - -- + a, --] a c c a >&solve(areaTriangle(A,P1,B)=7,u), P1u &= expand(P1 with %) 14 [u = ---] a c 14 b 14 [----, --] a c a >lv &= lineThrough(A,P2v); >lu &= lineThrough(P1u,B); >D &= lineIntersection(lv,lu) 2 7 a c + 84 b - 84 a 84 c [--------------------, -----------] 13 a c - 84 13 a c - 84 >sol &= solve(areaTriangle(A,D,B)=4,[a,b,c])[1] ... > with [%rnum_list[1]=s,%rnum_list[2]=t] 168 [a = ---, b = s, c = t] 5 t >&expand(areaTriangle(A,C with sol,P2v with sol)) - 3 39 -- 5 >&B with sol 168 [---, 0] 5 t >&C with sol [s, t] >&P1u with sol 5 s 5 t [---, ---] 12 12 >&P2v with sol 108 5 s 5 t [--- + ---, ---] 5 t 14 14

The problem is that there is more than one solution. The triangle is not determined by those three areas! However, the area in question is always the same. This is quite a surprising fact if we start algebraically as above. On the other hand, it is not surprising if we assume that the problem can be solved at all. For any transformation (x,y) -> (kx,y/k) keeps the areas intact. Moreover, any transformation (x,y) -> (x+c,y) keeps the given areas intact. So if we have one solution, we can effectively get another solution where C is placed anywhere.

I took the values into C.a.R. (with sliders for s and t, and B,C,D,P1,P2 according to the expressions above) and here is one such triangle.

The computations seem to work, and moving the sliders shows that 7.8 is indeed the solution to our problem.

Isn’t there an easier and more intuitive solution? I have not watched the linked video yet. But upon discussion with a friend, the solution occurred to me. Have a look at the following sketch.

The trick is to look at the triangle ABP1 and to see BP1 as its base side. Then divide the triangle into ADP1 and ABD. Those triangles have the same height upon BP1 and since the area is height times base over 2, we get (solving for the height)

\(\dfrac{4}{DB} = \dfrac{3}{DP1}\)

Now the same can be done in the CBP1. Thus

\(\dfrac{y+2}{DB} = \dfrac{x}{DP1}\)

Thus

\(\dfrac{y+2}{4} = \dfrac{x}{3}\)

Now we do the same with the triangles over the baseline AP2. We get in the same way

\(\dfrac{x+3}{4} = \dfrac{y}{2}\)

Now we have two equations for x and y. The solution is

\(x = \dfrac{21}{5}, \quad y = \dfrac{18}{5}\)

So

\(x+y = \dfrac{39}{5}\)

To find such solutions is a matter of practice, combined with trial and error, plus a grain of stubbornness. The brain needs to have enough math tricks to look for, simply. Then you need to look around if anything looks familiar to you.

## Avoiding CO2 Emissions

Sometimes I wished people (including myself) would think a bit more before they write. Looking around for CO2 sins, it is fairly easy to point the finger to flying. Indeed, aviation has tax privileges that hide the true costs of this means of transportation. This should be stopped. But in terms of CO2 output, modern airplanes are not that bad. Only the railway and especially travel buses are better. A car must be packed with at least 3 persons to beat the most modern airplanes. And airplanes should be used on distances only where cars or travel buses cannot compete at all.

The arguments usually continue with a claim for more railway connections. This, of course, does only help if the railways are (1) driven by regenerative energies and (2) replace other means of transportation. If those conditions are not met more and cheaper railway connections only add to the CO2 footprint of mankind. The most efficient way would be to stop driving our own cars and using travel buses. We should not think that individual traffic can go on like now in the future world of eleven billion people. An option is to reduce traveling before we are forced to do so. The means to achieve this are local economies and the net.

Moreover, traveling in total adds only 15% to the global CO2 emissions if my numbers are right. And flying is only a small part of traveling. By far the major emissions come from the industry, power plants and housing. And this will be rising due to the eleven billion people that will need basic resources to live. We should have stopped that growth earlier by education, fair chances, equal rights for women and shared welfare. But now my kids have to find a way to get the planet through this sickness called „mankind“. And there are ways to do it. We need new thinking and much more science, and a new awareness of the challenges we are facing. We don’t need a brutal business that ignores all warnings.

And we do not need simple solutions which ignore all statistical facts.

## Mathematische Software – Geogebra

This is the Android Version of GeoGebra. It is a lot more cumbersome to use than the desktop version, but you can get used to it. Although I will be criticizing it a bit below it is a very nice software. It can do far more than an average student would ever need. If you do not know the power of GeoGebra, have a look at its home page. My own programs Euler Math Toolbox or C.a.R. and others in the same category may be more powerful on many areas and more versatile. But GeoGebra offers an all-in-one package with teacher support and a world community. Over the years, they completed the program and added missing features. They even included 3D constructions and augmented reality. For this, we had to use specialized programs like Archimedes 3D or Cabri 3D, both payware. Moreover, they added JavaScript support on webpages so that constructions can still be embedded after Java has been killed in the browser. This free package is to be recommended.

Instead of writing a review, let me point out the shortcomings of CAS with regard to the learning process. No, I won’t be arguing that software hinders the process of acquiring mathematical skills and math has to be done with pencil and paper. Rather the contrary is true. I will be arguing for more software usage. But it needs to be used in an intelligent way. For that, we need intelligent teaching.

Have a look at the example in the image above. It was the first example I tried on my Android device. We are discussing the function

\(f(x) = e^{5x} \, \sin(x)\)

We want to learn its behavior. It is very difficult to get a really good impression on the Android device. You can try to zoom in and out. But without further information, you will not be able to grasp its structure. The software uses the nicest feature of touch screens, the pinch zoom. So you can zoom right into the interesting region as in the image above. Even then, it looks as if the function was zero left of -1.5.

If you zoom out further you see the following.

One can only understand this image if one knows how the two factors look like and have ever studied a dampened oscillation before. So the plot does not really help without the mathematical background. But, on the other hand, if you have the background the plot can be a huge help in asserting the knowledge and confirming it.

Next, I tried to find the first local minimum on the negative axis. You can solve that numerically in the program by touching the graph in the minimum. The software will then display one of these black dots showing all special points of the plot, and you can read the coordinates below the plot. I think this is a very nice way of grasping math and something EMT cannot do that easily. Of course, you can do it on the command line.

>function f(x) &= exp(5*x)*sin(x) 5 x E sin(x) >plot2d(f,-1,0.2); >xm=solve(&diff(f(x),x),0.2) -0.19739555985 >plot2d(xm,f(xm),>points,>add);

But let us talk about the CAS aspect of this solution. GeoGebra produces a very interesting solution to this problem.

\(\{ x = 2 \tan^{-1}(\sqrt{26}+5), \, x=2 \tan^{-1}(-\sqrt{26}+5) \}\)

There is a switch to evaluate this numerically. If it is pressed four surprising values appear: -191.31°, -11.31°, 168.69°, 348.69° (rounded). The degrees can most likely be avoided by setting the program to radian mode. The values are correct.

>fzeros(&diff(f(x),x),-200°,360°); %->° [-191.31, -11.3099, 168.69, 348.69]

What do we make of all this?

First of all, the computations, algebraic or numerical, do not make much sense without proper explanations and without the mathematical background. The zeros of the sine function and consequently of the function f simply are the multiples of 180°. Between each zero, the function has at least one extremum, alternatingly a minimal and maximal value. So much is easy to see with the naked eye. In fact, there is exactly one extremal point in each interval. This is harder to see, however. By computing the derivative, we get the extremal points as the solutions of

\(\tan(x) = – \frac{1}{5}\)

Every book about trigonometry contains a plot of the tangent function like the following.

I added the line y=-0.2. So you can easily see that the extremal points repeat in distances of 180°. Problem solved.

Why does GeoGebra produce such a complicated answer involving the square root of 26? That is a mathematical problem in itself and well above the capabilities of high school students. The reason may be connected to replacing sine with 1 minus cosine squared and solving a quadratic equation.

And why does it only show four of the infinitely many solutions? I do not know.

We learn from all this that numerical or algebraic software or plots can be useful. But without mathematical background they are useless.

## Durchschnitt und Median

Es ist unglaublich! In der offiziellen Antwort der CDU auf den Youtuber Rezo findet sich die altbekannte Stammtisch-Parole, dass der Zuzug von Jeff Brezos viele Menschen unter die Armutsquote treiben würde, weil sich ja das Durchschnittseinkommen dadurch erhöhen würde und daher die 60% des Durchschnittseinkommens, die Armut definieren, ebenfalls. Muss man sich noch wundern, dass die CDU den Unterschied zwischen Durchschnitt und Median nicht kennt? Dieses einfache Faktum sollte doch irgendjemand bekannt sein, der die Stellungnahme vor der Publikation gelesen hat. Die CDU bestätigt damit auf geradezu eindrückliche Weise die Behauptung Rezos über die Inkompetenz der in dieser Partei agierenden Politiker.

Übrigens wird auch noch das ebenso dämliche Argument von der Nachkriegszeit gebracht. Dort hätte es keine Armut gegeben, weil ja alle gleich arm gewesen sind. Ich bezweifle, dass das von den Zahlen her über die 10 Jahre nach Kriegsende grundsätzlich stimmt. Auch damals gab es schon gut Verdienende und sogar Reiche. Das gleiche gilt auch für den von der CDU angenommen Sozialismus, in dem angeblich jeder gleich viel hatte. Spätestens in der Endphase der Sovjetunion habe ich da Zweifel, ob nicht doch zahlreiche Arme zu finden waren, und zwar im Sinne der Armutsdefinition am Median. Aber das ist irrelevant. Denn Armut bemisst sich auch relativ zu den Lebenskosten. Es sind steigende Mieten, steigende Fahrtkosten, Schulkosten und andere Dinge, an denen Arme scheitern.

Noch blöder ist das Argument, man könne sich heute doch viel eher einen Fernseher leisten als früher. Das wurde schon in den Nachdenkseiten auseinander genommen, und ich muss hier nicht mehr dazu sagen. Bitte nachlesen!

## Mathe-Abitur – too difficult?

Maybe I should write this in German. But why not in English? After all, we need more European standards in education. And the discussion may be of interest to students in other nations. Be aware, however, that the levels of mathematics in schools are quite different between countries like India, China, Germany or the USA. But all have something in common. And that will be the point of this posting.

Currently, we have an uproar about the 2019 mathematical test for the German Abitur. In case you are not familiar with the German system, the Abitur is a final examination of the highest level of school education in Germany. It is usually written at the age of 17/18 after 12/13 years of school life and qualifies for an entrance to the Universities. The test contains centralized elements now for all of Germany to guarantee the same level for all states in Germany (the Bundesländer). By law, each state is responsible for education in its schools. The teachers have to select sets of problems from this pool to make the results more comparable.

The students claim that the test was much more difficult than last year, and contained unexpected problems. The final word about this will be out soon when the grades of this year and last year can be compared. However, petitions were signed by thousands of students to lower the requirements this year. Obviously, not only participants in the test signed. This shows the public interest in the matter, and also the problems with mathematical education in the general public.

A typical example of this attitude I heard in a radio interview with a mathematician who organizes the Mathematical Olympiad in Germany. The question was: „If the math test in the Abitur was already that difficult why do we need mathematical Olympiades?“ It simply reflects the general tenor of „Who needs mathematics?“. The interviewed mathematician replied very politely, where I would have been much more direct and would have asked: „Why do we need a high jump?“ The interview goes on with asking if the math problems of the Abitur could be used for the Olympiade. Again, the answer was polite, but a bit off in my opinion: The Abitur is more on reproducing known techniques, and the Olympiade is on creating ingenious solutions. This answer made me write this posting. I think it is wrong and misleads the public view on mathematics.

The truth is that the successful participants of the math Olympiad all practice quite a lot. They have meetings, they read books, and they study old problems. I once hosted one of their sessions and saw how serious they take mathematics. They have a lot of tricks up their sleeves that the innocent student has never heard of. Practicing is the secret to success. It is the same as in all other competitive activity, including the Olympic Games. You do not expect a high jump professional to be excellent in table tennis. It is not what he learned and improved with thousands of repetitions. And being an expert in Algebra does not make you a brilliant applied mathematician, as well as the other way around. Human intelligence relies on learning and recognizing, and not on brilliant extraordinary ideas. Those happen only to the ones that have studied the most.

Getting back to our „Mathe-Abitur“, we have to face the truth that we have to teach the necessary skills before we can ask students to apply them. There is no principle difference between reproductive tasks and so-called transfer tasks. It is just so that the easy problems make it obvious which skills have to be applied, and the difficult problems hide this and may require more than one skill. The student needs to learn to sort out the mathematical content from the given text and see how he can apply the learned material to the problem. This is a skill of its own.

In summary, we cannot really judge the difficulty of an exam without knowing the details of the teaching that prepared for the exam. The only other way is to study previous exams. Clever students do, of course, look at these on their own. For most students, this must be part of the teaching. At this time, the only way to convince me that the problems were too hard would be a petition by the math teachers. They are the experts. A serious drop in the grades would also need an investigation, with input by those that really face the students, the math teachers.

## EMT – Simulation of the Two Child Problem

The two child problem is a problem in probability theory with a solution that seems paradox on first sight. I wrote about that problem before. Let me repeat the explanation and do a simulation to convince everybody that the solution is really correct. You can find information on that problem on Wikipedia.

The first simple version starts with this story: You meet a man in a bar and he mentions his daughter. You ask him about his children and he answers that he has two kids. The question is: What is the probability of the other kid (the one he was not talking about) to be female?

The answer depends on some important details. But let us assume you have no information if the other kid is younger or older, or any other special information about the daughter and the man is just a random man from the population. These details will turn out to be important! Then the intuitive answer to our question 1/2 is wrong, or rather, it does not make sense. The correct answer is 1/3.

In my opinion, each probabilistic problem makes sense only if we can devise an experiment that would in theory or in practice simulate the problem. Our computation should predict the outcome of the experiment. Problems that cannot be simulated in any way are not interesting to me. This includes most problems in probability or measure theory which need the help of the axiom of choice.

But our problem can easily be simulated. And setting up the simulation gives great insights into the meaning of our question and the terms „probability“ and „randomly selected“. Let us do it in Euler Math Toolbox (EMT). What we do is a Monte-Carlo simulation. We need to make the following assumption: The man has two kids with random gender, one of which is female, and the probability for a kid to be either gender is 1/2 (no diverse genders in this posting). So we draw 1000000 pairs of kids with random gender. Then we count the proportion of two female kids among all pairs with at least one female kid.

>n = 1000000 1000000 >K = intrandom(2,n,2) Real 2 x 1000000 matrix 2 1 1 2 ... 1 2 2 2 ... >i = nonzeros(K[1]==1 || K[2]==1); ni = length(i); ni/n 0.749596 >sum(K[1,i]==1 && K[2,i]==1) / ni 0.334372115113

The syntax may seem cryptic, but it is intuitive if you understand the Matrix language. K contains a pair of kids in each column (n=1000000 columns). „K[1]==1“ returns a vector of 0/1 with 1 (true) on each position where the vector K[1] (the first row of K) is 1. I.e., a vector indicating the pairs where the first kid is female. „||“ is short for „or“, and nonzeros() returns the indices of the non-zero elements of a vector. Thus „ni“ is the number of pairs such that either kid is female. As expected, „ni/n“ is approximately 3/4. There are four cases, and one case (tow boys) is wrong.

In the final line, we count the numbers of pairs in the „i“-columns, where both kids are female, using sum() which sums up the ones and compare that to the total number of right cases „ni“. The answer is approximately 1/3.

This should not surprise us since there are three cases in the „i“-columns: (1,2), (2,1), (1,1). Only one of these cases is the correct one.

Why does the problem depend on the details? For this, we assume that it is Tuesday and the man in the bar has her birthday today. Surprisingly, this changes the problem completely! Even if we only know that the daughter is born on a Tuesday the problem changes drastically.

Let us start with the Tuesday problem. We simulate the same now by randomly selecting weekdays for the birthday of both kids.

>n = 1000000; >K = intrandom(2,n,2); >D = intrandom(2,n,7) Real 2 x 1000000 matrix 7 4 6 4 ... 7 2 5 5 ... >i = nonzeros((K[1]==1 && D[1]==2) || (K[2]==1 && D[2]==2)); ni = length(i); ni/n 0.137799 >sum(K[1,i]==1 && K[2,i]==1) / ni 0.481679838025

The code did not change very much. But the „i“-columns now contain only columns with one Tuesday girl (2 means Tuesday above). The probability for this much lower, of course. We have 4*49=196 cases in total (4 gender pairs, 7 days for each). Of these, only 13 contain a Tuesday girl. There are 6 with the first kid a Tuesday girl and the other a girl born on another day, and 6 with the younger in the same way, and one with two Tuesday kids, plus 14 cases with one Tuesday kid and a boy. This is 27/496~0.13775.

Out of these 27 cases, we have 13 cases with two girls, as computed above. We have 13/27~0.48148. The simulation works as good as it can. The accuracy of a Monte-Carlo simulation is only about 1/sqrt(n)=1/1000.

If we know that the birthday is today we can just take the probability as 1/2. In this case, the pick of the other child is almost independent of the pick of the first child in contrast to the original problem. And that is the true reason for the confusion. If we had known that the girl is the elder one the pick of the other child is independent and thus female with probability 1/2. But we only know that one of the kids is female. That changes the situation completely and both picks depend on each other.

I recently saw a Youtube video which I do not link here because it only adds to the confusion. The video could not explain why it makes a difference between knowing that the girl has a birthday, and knowing the precise birthday. This is easy to explain if you think of an experiment as above. Drawing a man with two kids, one of them being a daughter, is a different experiment than drawing a man with two kids, one of them is a daughter born on a Tuesday.

## Ellipse Geometry – a Problem

I found the following nice problem in my Facebook account. Facebook, however, is a miracle to me and I am always unable to find a posting a second time. Unless you answer something silly like „Following“ it is lost. The best I could find was this link.

The problem is to prove:

*The intersections of two perpendicular tangents to an ellipse form a circle.*

Of course, this can be computed by Analytic Geometry and I carry this out below. It is no fun, however. E.g., you can find the radius of the circle if the claim is correct, take a point on the circle, compute the two tangents to the ellipse and check that they are perpendicular.

Let us find a more geometrical solution! At first, there is a well known „construction“ of ellipses folding a circular paper. You can do it with actual paper. Cut a circular paper. Mark a point A inside the circle. Then fold the paper, so that the boundary lies on A. I.e., the point P is reflected along the folding line to A. The line is the middle perpendicular of AP. If you do that often enough the folds will outline the green ellipse. There are even videos on Youtube showing this.

For the proof, you need that ellipses are the set of points where the sum of distances to A and M is constant. In our case, it is „obviously“ constantly equal to the radius of the circle. We have the following.

*The set of all middle perpendiculars to a fixed point A and points P on a circle is the set of tangents to an ellipse.*

Now you know how to get two perpendicular tangents. In the following construction, I did just that. The four blue lines are four middle perpendiculars. They are constructed by selecting a point P on the black circle, the line PA and a rectangular to that line. Then the blue lines are the four middle perpendiculars on A and the four intersections of our green lines with the circle.

We have to prove that

- the midpoint Z on AM is the center of the rectangle
- and that the rectangle has the same diameter, independent on the choice of P on the black circle.

Then the corners of the blue rectangle will always be on the same circle.

Now, we stretch the blue rectangle by a factor 2 from the center at A. The point Z will be stretched to the point M then. The blue rectangle will become a rectangle through the intersections as in the following construction.

It is now „quite obvious“ that M is the center of the blue rectangle. Thus Z was the center of the 1/2 times smaller rectangle. This proves our first claim.

For the second claim, we need to show that the length of the diagonal of the large blue rectangle does not depend on the choice of the red point. The diagonal has the length

\(\sqrt{c^2+d^2}\)

by Pythagoras. Now we have another claim.

*The sum of the squares of the lengths of each two perpendicular secants of a fixed circle that meet in a fixed point inside the circle is constant.*

To prove that have a look at the dashed rectangle with diagonal AM. Using this rectangle and Pythagoras you can „easily“ express the diagonal of the blue rectangle by the length of AM and the radius of the circle. This proves the second claim.

The images in this posting have been done with C.a.R. (Compass and Ruler), a Java program developed by the author. It allows beautiful exports of images and the automatic creation of polar sets for sets of lines. That feature was used to compute the ellipse in the second image. The first ellipse was done using the two focal points. C.a.R. has also ellipses defined by 5 points, or even by an equation or a parameterization.

I promised to compute the problem using Analytic Geometry. I am using the Computer Algebra system Maxima via my Euler Math Toolbox for this.

The first method computes two perpendicular tangents to the ellipse with the equation

\(x^2 + c^2 y^2 = 1\)

To find a tangent perpendicular to a vector v, we can maximize the expression

\(v_1 x + v_2 y\)

on the ellipse using the method of Lagrange. If the vector v has norm 1 the value of this maximum will be the distance of the tangent from the origin. The Lagrange equations fot his are

\(v_1 = 2 \lambda x, \quad v_2 = 2 \lambda c^2 y, \quad x^2+c^2 y^2 = 1\)

After solving this, we get

\(v_1 x + v_2 y = 2 \lambda (x^2+c^2y^2) = 2 \lambda\)

Then we do the same with the orthogonal vector, i.e., we maximize

\(-v_2 x + v_1 y\)

We then show that the sum of squares of these two values is constant.

In EMT and Maxima, this is the following code.

>&solve([v1=2*la*x,v2=2*la*c^2*y,x^2+c^2*y^2=1],[x,y,la]); ... > la1 &= la with %[1] 2 2 2 sqrt(v2 + c v1 ) ------------------ 2 c >&solve([-v2=2*la*x,v1=2*la*c^2*y,x^2+c^2*y^2=1],[x,y,la]); ... > la2 &= la with %[1] 2 2 2 sqrt(c v2 + v1 ) ------------------ 2 c >&factor(la1^2+la2^2) 2 2 2 (c + 1) (v2 + v1 ) -------------------- 2 4 c

Thus the circle of intersections has the radius

\(r = \dfrac{\sqrt{1+c^2}}{c} = \sqrt{1 + \dfrac{1}{c^2}}\)

This is confirmed by the special case of tangents parallel to the axes.

There are several other methods. One is to construct the tangents using tangents to a circle. For this, the ellipse needs to be stretched by 1/c into y-direction. It will then become a circle. We need to compute points on the image of our circle with radius r under this mapping, then take the tangents to the mapped ellipse and map back. Below is the plan of such a construction.

The computations are very involved, however.

Another method to find both tangents is the following: We look at all lines through a given point (e.g. determined by their slope) and find the ones that intersect the ellipse only once. The product of the two slopes that solve this problem should be 1. Again, this is a complicated computation.