Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004

The IDEA of the  pythagorean theorem has been in existence since even before 2500 B.C, but circa 300 B.C. Euclid presented the theory. The pythagorean theorem is simply the idea of pythagorean triples, or a^2 + b^2 = c^2. What it really means is leg squared plus leg squared equals hypotenuse squared. In any right triangle, the area of the side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at the right angle). 

def hypotenuse(a,b): return sqrt(a^2 + b^2)
hypotenuse(3,4)
5
hypotenuse(5,12)
13

The sage notebook feature (shown above), demonstrates how the pythagorean theorem works. By hand, one would write out and solve the following equation:

a^2 + b^2 = c^2

3^2 + 4^2 = c^2

9 + 16 = 25

5 = sqrt25

thus, a student has found the value of the hypotenuse of the triangle. It could also be used in reverse by supplying the value of the hypotenuse and one leg, and finding the value of the missing leg.  As one can see, writing this equation out by hand is an arduous task that can easily be solved using sage, without losing sight of the actual theorem or how to use it. This enables students to understand the material, as well as solve equations efficiently. Used above, there are certain triangles, known as pythagorean triples, that are already known to have an exact value. These are some examples: 3,4,5/ (any multiple of 3,4,5 such as 6,8,10 or 9,12,15) and ,5,12,13.

hypotenuse(6,8)
10
hypotenuse(9,12)
15

This is an example of how one can find the value of a leg by suppling the value of one leg and the hypotenuse.

leg(4,5)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_8.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bGVnKDQsNSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpoV0BWW/___code___.py", line 3, in <module> exec compile(u'leg(_sage_const_4 ,_sage_const_5 )' + '\n', '', 'single') File "", line 1, in <module> NameError: name 'leg' is not defined

Euclid found a way to create integer Pythagorean triples. This is what it is.

def ptriple(m,n): a=m^2-n^2 b=2*m*n c=m^2+n^2 return a,b,c
ptriple(3,2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_10.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cHRyaXBsZSgzLDIp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpvudqk6/___code___.py", line 3, in <module> exec compile(u'ptriple(_sage_const_3 ,_sage_const_2 )' + '\n', '', 'single') File "", line 1, in <module> NameError: name 'ptriple' is not defined
ptriple(3,2)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_11.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cHRyaXBsZSgzLDIp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpbRJ9VA/___code___.py", line 3, in <module> exec compile(u'ptriple(_sage_const_3 ,_sage_const_2 )' + '\n', '', 'single') File "", line 1, in <module> NameError: name 'ptriple' is not defined
def ptriple(m,n): a=m^2-n^2 b=2*m*n c=m^2+n^2 return a,b,c
ptriple(3,2)
(5, 12, 13)
ptriple(7,6)
(13, 84, 85)
ptriple(9,2)
(77, 36, 85)

In general, the pythagorean theorem is one of the most important theorems in existence. The theorem is used in proofs, such as the sililarity proof, Euclid's proof, and proofs by subtraction and rotation.