Showing posts with label equilateral triangle. Show all posts
Showing posts with label equilateral triangle. Show all posts

Tuesday, 26 May 2020

The Broken Stick Puzzle


Recently I was watching a YouTube video in which a person was investigating the so-called Broken Stick Puzzle using GeoGebra. I realised that it would be interesting to investigate the problem using SageMath, which is what I'll demonstrate in this post. 

However, firstly let's state what this puzzle is about:
Two points are chosen independently and at random on a stick. The stick is broken at those points to form three smaller sticks. What is the probability these three sticks can form a triangle?
My first thought was that the probability would be 0.5 but that turned out to be wrong. Figure 1 shows the variables that I used in my SageMath algorithm, namely pos1, pos2, side1, side2 and side3 for the case where pos1<pos2.

Figure 1

The code runs as follows, in which the variable YES, NO and trials are used as well:
YES,NO=0,0
trials=100000
for i in [1..trials]:
    pos1=RR.random_element(0,1)
    pos2=RR.random_element(0,1)
    side1=min(pos1, pos2)
    side2=abs(pos1-pos2)
    side3=1-(side1+side2)
    if max(side1, side2, side3)>0.5:
        NO+=1
    else:
        YES+=1
print("Relative Frequency of Triangles", n(YES/trials, digits=4))
print("Relative Frequency of non-Triangles", n(NO/trials, digits=4))
 The result, for 100,000 trials, are as follows:
Relative Frequency of Triangles 0.2515
Relative Frequency of non-Triangles 0.7485
Here is the permalink to SageMathCell. Of course, this doesn't prove that the probability of forming a triangle is 0.25. However, it can be shown why the probability is 0.25. This proof is taken from this site:
This altitude theorem can be used to find an answer to a famous probability problem:  If a stick of length x is broken into three pieces, what is the probability that the three pieces can be used to construct a triangle? 
This problem is more difficult than it may originally seem because the sum of the two smaller sides of the triangle must be greater than the third side.  For instance, if the stick is broken into pieces of 2 inches, 3 inches, and 10 inches it will be impossible to construct a triangle. 
Given an equilateral triangle with altitude x, it is possible to use geometry to solve the problem.
 
Any point within the triangle can represent how the stick is broken into three pieces.  For instance, if point P is selected, that represents that the stick is being broken into pieces with length a, b, and c.  By the altitude theorem, it is known that a + b + c = x. 
In this example it would not be possible to make a triangle, because a + b < c .
To find the probability that the two smaller sides will sum to be larger than the third side it is helpful to divide the equilateral triangle into four smaller equilateral triangles, by connecting the midpoints of the sides.
  
As long as point P is selected in the middle triangle, it will be possible to create a triangle from the three pieces.  (Why?)  The probability that randomly selected P is in the middle triangle is 1/4 so the probability that a triangle can be created from breaking a stick into three pieces is 1/4.
In this proof, the "altitude theorem" referred to is better known as Viviani's Theorem. It's easy to show, using the diagram, that \(s+t+u=h\) where \(h\) is the altitude of the triangle. To do this, suppose the equilateral triangle has a side length of \(a\). Then:$$ \text{Area of Triangle }=\frac{a \times h}{2}=\frac{a \times s}{2}+\frac{a \times t}{2}+\frac{a \times u}{2}$$The 2's and a's cancel out to leave the result of the theorem.

For any interior point P, the sum of the lengths s + u + t
equals the height of the equilateral triangle.

There are variations on this puzzle. Here is one of them taken from this source:
Suppose point A is chosen first, at random, and the stick is broken at this location. Point B is then chosen at random from the longer of the two resulting sticks. What is the probability these three sticks form a triangle? 
Here is the code for this situation (permalink):
YES,NO=0,0
trials=1000000
for i in [1..trials]:
    pos1=RR.random_element(0,1)
    if pos1>0.5:
        pos2=RR.random_element(0, pos1)
        side1=pos2
        side2=pos1-pos2
    else:
        side1=pos1
        pos2=RR.random_element(0,1-pos1)
        side2=pos2
    side3=1-(side1+side2)
    if max(side1, side2, side3)>0.5:
        NO+=1
    else:
        YES+=1
print("Relative Frequency of Triangles", n(YES/trials, digits=4))
print("Relative Frequency of non-Triangles", n(NO/trials, digits=4))
The result, this time for 1,000,000 trials, is as follows:
Relative Frequency of Triangles 0.3865
Relative Frequency of non-Triangles 0.6135
Thus the likelihood of forming a triangle increases because we never break the shorter stick, as was possible in the first instance. At the moment I can't explain the numbers that have been thrown up. Here is the second variant:
Suppose point A is chosen first, at random, and the stick is broken at this location. One of the two resulting sticks is then chosen at random and split at a random location. What is the probability these three sticks form a triangle? This may sound the same as the original problem, but it isn’t!
Here is the algorithm I developed for this situation (permalink). Again it's for a million trials:
YES,NO=0,0
trials=1000000
for i in [1..trials]:
    pos1=RR.random_element(0,1)
    pos2=RR.random_element(0,pos1)
    side1=pos1
    side2=pos2
    side3=1-(side1+side2)
    if max(side1,side2,side3)>0.5:
        NO+=1
    else:
        YES+=1
    pos2=RR.random_element(0,1-pos1)
    side1=pos1
    side2=pos2
    side3=1-(side1+side2)
    if max(side1,side2,side3)>0.5:
        NO+=1
    else:
        YES+=1
YES=int(YES/2)
NO=int(NO/2) 
print("Relative Frequency of Triangles", n(YES/trials, digits=4))
print("Relative Frequency of non-Triangles", n(NO/trials, digits=4)) 
This time the results are:
Relative Frequency of Triangles 0.1730
Relative Frequency of non-Triangles 0.8270
This situation produces the least likelihood of a triangle being formed. After the first break, the shorter of the two pieces can be chosen and broken again but this is futile because the other piece is already greater than 0.5. The longer of the two pieces can also be chosen with equal probability and broken. I can't explain the numbers that have been thrown up. I'll keep investigating.

A much harder question is:
Five points are chosen independently and at a random on a stick. The stick is broken at those points to form six smaller sticks. What is the probability these six sticks can form a tetrahedron?
Here is a recent undergraduate student paper about the topic: link.

Sunday, 7 January 2018

432 Hz versus 440 Hz

I've been aware for a while about the the controversy surrounding the standard A note and whether it should be set to \(440 \text{Hz} \) (as it now is) or changed to \( 432 \text{Hz}. \) I'm trying in this post to look at the mathematical properties of \( 432 \).
  • \( 432^2 = 186624 \) is close to the speed of light as measured in miles per second. Wolfram Alpha gives a figure of \( 186282 \) miles per second for the speed of light in a vacuum which is \( 99.82 \text{%} \) of \( 432^2 \).

  • It also turns out that the area of an equilateral triangle whose numerical area is equal to its perimeter is given by \(12 \sqrt{3} = \sqrt{432} \).

  • \( 432 \) sits between the twin primes \( 431 \) and \( 433 \)

  • The factors of \( 432 \) are \( 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 36, 48, 54, 72, 108, 144, 216 \text{ and } 432 \). The sum of these divisors is \(1240 \).

  • \(432 \) is a 3-smooth number, one that is of the form \( 2^i*3^j \text{ where }i,j>=0 \) or to put it less mathematically it is a number that can be written as a power of two times a power of three, specifically \( 2^4×3^3 \). Such numbers have been called harmonic numbers. Here are the harmonic numbers up to \( 1000 \):


  • \( 432 \) is the sum of four consecutive primes: \(103+107+109+113 = 432\)

  • \( 432 \) is the sum of two positive cubes: \( 6^3+6^3=432 \)

  • OEIS lists \( 2944 \) entries for the number \( 432 \)

Saturday, 2 December 2017

25080: A Number Of Interest

The number of OEIS entries for numbers in the region 25000 can be quite few. For example, 25079 has three entries, 25078 has six, 25077 has five and so on. Thus it was surprising to note that 25080 has an impressive 43 entries. It helps that it's highly factorisable: 2 x 2 x 2 × 3 × 5 × 11 × 19. Let's look at one of these entries.

OEIS A102341: areas of 'close-to-equilateral' integer triangles. To quote from OEIS:
A close-to-equilateral integer triangle is defined to be a triangle with integer sides and integer area such that the largest and smallest sides differ in length by unity. The first five close-to-equilateral integer triangles have sides (5, 5, 6), (17, 17, 16), (65, 65, 66), (241, 241, 240) and (901, 901, 902).
The corresponding sequence of areas for these triangles is 12, 120, 1848, 25080, 351780. So the 'close-to-equilateral' integer triangle with sides 241, 241 and 240 has an integer area of 25080. Here is the image that I posted to my Twitter account, taken from WolframAlpha:

Here is further detail from the OEIS entry:
Heron's formula: a triangle with side lengths \( (x,y,z)  \) has area \(A = \sqrt {s*(s-x)*(s-y)*(s-z)} \) where \(s = (x+y+z)/\)2. For this sequence we assume integer side-lengths \(x = y = z \pm 1 \). Then for \(A \) to also be an integer, \( x+y+z \) must be even, so we can assume \( z = 2k \) for some positive integer \( k \). Now \( s = (x+y+z)/2 = 3k \pm 1 \) and \(A = \sqrt{(3*k \pm 1)*k*k*(k \pm 1)} = k*\sqrt{3*k^2 \pm 4*k + 1} \). To determine when this is an integer, set \( 3*k^2 \pm 4*k + 1 = d^2 \). If we multiply both sides by 3, it is easier to complete the square: \((3*k \pm 2)^2 - 1 = 3*d^2 \). Now we are looking for solutions to the Pell equation \( c^2 - 3*d^2 = 1 \) with \( c = 3*k \pm 2 \), for which there are infinitely many solutions: use the upper principal convergents of the continued fraction expansion of \( \sqrt{3} \). 
 Here are links supplied in the OEIS entry: