Pythagorean Theorem! 📐
How are y'all doing? Hope everyone is chilling and doing well!
Welcome to a tutorial on the Pythagorean Theorem!!! 🎉
You've probably already heard of Mr. Pythagoras and his famous Theorem, and with this tutorial we'll be learning about him, looking at what his Theorem is about, some fun facts about it, and finally a small program to calculate the hypothenuse and/or determine if a triangle is right-angled (and a few other things)!
Let's start!! xD
- Famous Works
2) The Pythagorean Theorem
- What it Is
- How it Works
3) Fun Facts
- Theorem Well Known Before
- 4 Lives
4) The Program
- How to Use
- Brief Explanation of Code (And a bit of Math)
- Helpful Links
Behold the man himself:
Pythagoras was an Ancient Greek Philosopher born in Samos, Greece in about ~570 BCE. He died in Metapontum, Italy, in about ~490 BCE, at the age of around 75 years old. Pythagoras spent most of his early life on the island of Samos, but when he was about 40, he emigrated to a city in Italy, Cortona. This is where most of his philosophical activity occurred.
Pythagoras was well brought up and well educated; he could play the lyre and recite poems as well as Homer. He was also interested in philosopy, mathematics, astronomy, and music. Pythagoras was influenced by some men like Pherekydes (a thinker), Thales (a mathematician), and Anaximander (a philospher). He was often called the first "True Mathematician"!
In about ~518 BCE, Pythagoras founded a philosophical and religious school in Crotona (a Greek colony in Italy). This was where he and some followers lived and worked. They worked together on discoveries and theories.
- Numerical System
Pythagoras started the idea of a numerical system, which is the beginning of mathematics. In a nutshell, the numerical system is:
"A numeral system is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner. "
- Numbers with "personalities"
According to him, numbers were vital and made up the world.
Each number had its own personality - masculine or feminine, perfect or incomplete, beautiful or ugly. This feeling modern mathematics has deliberately eliminated, but we still find overtones of it in fiction and poetry. Ten was the very best number: it contained in itself the first four integers - one, two, three, and four [1 + 2 + 3 + 4 = 10] - and these written in dot notation formed a perfect triangle.
- Pythagoras' Philosopy
Pythagoras and his followers hypothesized that everything in the universe could be clarified, or explained, with numbers. For example, today, we use numbers for calculating chances of precipitation, how fast a vehicle is going, wind speeds, etc.
- Music Theory
This one is kinda an unusual one; it's about intervals in music, and I found it pretty interesting:
Pythagoras is also credited with the discovery that the intervals between harmonious musical notes always have whole number ratios. For instance, playing half a length of a guitar string gives the same note as the open string, but an octave higher; a third of a length gives a different but harmonious note; etc.
Non-whole number ratios, on the other hand, tend to give dissonant sounds. In this way, Pythagoras described the first four overtones which create the common intervals which have become the primary building blocks of musical harmony: the octave (1:1), the perfect fifth (3:2), the perfect fourth (4:3) and the major third (5:4). The oldest way of tuning the 12-note chromatic scale is known as Pythagorean tuning, and it is based on a stack of perfect fifths, each tuned in the ratio 3:2.
To represent it better:
2) The Pythagorean Theorem
What it Is
You all most likely know about the Pythagorean Theorem, and we all encounter it at school in math class.
So here's a little crash course if you havn't been listening!
Basically, let's say we have a rectangle triangle
ABC with a 90˚ right angle on
B (not real lengths):
Let's say side
3 and side
4. What does side
That's when we'll use this formula (when I write
^2 it means squared or 'to the power of
AC^2 = AB^2 + BC^2
AC squared equals the sum of sides
AB squared and
BC squared. So using the measures from the previous example:
There, now we have
AC^2 = 25! Now to just find side
AC, we can square root it:
Voilà, we've found out that
AC, the hypothenuse of triangle
How it Works
Now why and how does this interesting equation work? To visualize it better, imagine if you put squares with length the side of each side of the triangle, like this:
To calculate the area of a square, it's
side^2, so with the formula that squares each side of the triangle, we now have squares. So the area of the red square (on the hypothenuse) is equal to the sum of the areas of the two other squares.
3) Fun Facts
Some cool facts about Pythagoras and the Pythagoras Theorem:
Apparently, this theorem was well known by Indian, Chinese, Babylonian, and Greek mathematicians well before Pythagoras lived.
Some historians think Pythagoras had a medical condition called synesthesia. People affected with synesthesia makes them able to see music, "hear" colors, and connect certain smells with people's name. This is perhaps how he thought of his Music Theory.
How exactly Pythagoras died is still a mystery. Pythagoras' followers went into conflic with supporters of democracy and other topcis, and Pythagoras' group's houses where they met were bruned down. Maybe Pythagoras was killed in those burnings, or maybe he escaped to Metapontum ad eventually died there.
Pythagoras declared to have lived 4 lives. Yes, 4. He also once said he remember those lives.
The Pythagoreans believed that the number
1was symbol of unity and was the origin of all things.
3meant male. The number
10was the most perfect number as
1 + 2 + 3 + 4 = 10.
4) The Program
How To Use
So when you run the code, you'll find yourself in the main menu. You'll have different modes to choose from; the first mode where you can find the length of the hypothenuse in a right-angled triangle, the second mode where you can check if a triangle is right-angled, and the last mode where you can check your history and find out your previous calculations.
For the mode 1 (by the way, I'm using
getch() so you don't have to press
input()), you'll have to enter the lengths of the triangle other than the hypothenuse. Like the program says:
Where side C is the hypothenuse, and side A and B are the other sides.
After entering those values, you can also choose how many digits after the decimal point (5 max). Next, the program shall calculate for you the length of the hypothenuse and detail the steps.
Then when you get back to the menu and try out the second mode to check if a triangle is right-angled, this time you'll have to enter the 3 lengths of the triangle. It'll check if it's right-angled, again detailing the steps, and will give the final verdict.
Finally, with the history, you'll have all your recent calculations, for both mode 1 and mode 2. You can also clear your history if you want.
Brief Explanation of Code (And a bit of Math)
So first, some imports like
math (for square rooting),
os (to clear the console screen),
time. Next, some variables holding
ANSI escape codes for the colors. After that, you'll see the dict
history_operation that holds the calculation as item and the result as value. There's also the variable
incrementer for outputting the contents of the history (with a
for loop). Finally, there's the
digits_after_decimal variable that's initally
Next we have the 2 functions for the 2 modes. Those functions have
float(input())s for getting the numbers from the users. Then, the program calculates all the values using
math.sqrt and gives the result (with nice colors); either the length of the hypothenuse or wether the triangle is right-angled or not. At the end of each functions, it saves the results in the dict for the history.
Finally, with the last function
history_functions(), it clears the screen using
os.system('clear') and with a
for loop outputs each item and value of the
history_operation dict (if the dict isn't empty.)
while True loop, it displays the menu choices, and with some conditionals calls the functions based on what the user wants to do. That's about all, a pretty straightforward program.
Read the comments I inserted into the code for more! ;)
- Stanford Enclocypedia
- Brain Pickings
- Math Open Reference
- Ancient History Lists
- Story of Mathematics
- Math is Fun
For more about the Pythagorean Theorem and about Pythagoras, you can visit the links above and here are a few more:
Well, that's about all. I hope you've learnt something cool and new about Pythagoras and the Pythagorean Theorem. This can help you in math class, so go amaze your classmates and teachers!
- Also, you know, try to learn the real way of how to calculate the hypothenuse; this program was just for 'illustrating purposes', you probably shouldn't use or rely on this during a test lol. But have fun with it anyways! :)
And also this amazing video, I have no idea this works but it's super amazing. Check it out!
Until we meet again! 👋
PS: In case you missed it, run the repl as there is a program.
PPS: Extend the console to the maximum so you can see the most!! :)
This is to much please get this removed off replit before more peoples brain explodes.
I, speaking on the behalf of the council of 2-year-olds, are not pleased with this. We do not know what your...putting a number to the power of 2 is and we do not know what the '+' sign means. You should have explained in further detail...BTW I know what all of these terms mean, just the council told me to say this to you.
P.S. the one word that caught my attention
@Whippingdot I, replying on behalf of over 13 year olds (because 2 year olds aren't allowed on repl.it according to the ToS), understand completely your opinion. However, you can tell your.. 2-year-olds that for example x to the power of 2 is x times x. So if x = 5, x to the power of 2, or rather x^2 = 5^2 = 25.
And the '+' sign means addition meaning that 1 + 1 = 11. That is understandably harder to understand.
Oh ok thx
LOL! I made a similar thing a while ago in C#, but it had no colors and was a lot lazier, with no decimal point asking or explanation. It just took inputs and spit out the answer.
Idk if its just me, or do i feel like anyone can speak poems if they have vocal chords? I would say something like recite poems meaning that he memorized them or wrote them...
just a suggestion tho