Pythagorean theorem

for teachers

Possibilities of use for motivating students or teaching programming

The Lego robot shows an illustrative example of the area of squares in Pythagorean theorem.

Prerequisite

What students should know before

  • Pythagorean theorem,

  • calculating the interior and exterior angles,

Time constraints:

  • starting from 45 min - single lesson

Preparing For This Tutorial:

  • The LEGO Mindstorm EV3 Robot that coincides with this tutorial comes from building specific sections found in the LEGO Mindstorm Education Core Set building instructions. You will need to build the main body for the robot or you could prepare your own robot - see

(compare modul ,,Robot drawing triangles”)

Effects

Mathematics - Motivating the students – revision of Pythagorean theorem, calculating the interior and exterior angles, two-dimensional demonstration of the ratio of areas (when used as a motivating factor). If a pen is used, it draws a curve of the route. Pay attention to the repetition of moves.

Computer science - Learning programming in Python. Students have to analyse the necessary moves, indicate programming steps, take positive and negative rotation into account, and think about when the pen needs to be raised or lowered. The lengths of catheti need to be adapted to the performance and size of the Lego robot.

Exercise

The data are: the catheti in a right triangle. Write a program in which the robot draws a triangle and then three squares. Two are built on the catheti and the third on the hypotenuse.

Example solution

Motivating the students

Students enter the data of catheti: a and b. The other necessary data are calculated by the programme, taking into account:

  • The length of the hypotenuse c – to calculate the length of hypotenuse use \(a^{2} + b^{2} = c^{2}\)

  • Interior triangle angles α and β, angles needed for rotation β1=(π – β) and α1=( π -α) , to calculate we use β=tg-1(a/b) α= π /2-β (radian measure is used for angles)

Learning programming in Python:

  • Length of hypotenuse c – to calculate the length of hypotenuse use \(a^{2} + b^{2} = c^{2}\) -> c=math.sqrt(a*a+b*b)

  • Interior triangle angles α and β, angles needed for rotation β1=( π – β) and α1=( π -α) , to calculate we use β=tg-1(a/b) α= π /2-β beta=math.atan(a/b)

(radian measure is used for angles)

Diagram indicating programming steps and programme code: image0

We number the moves in the sketch chronologically when analysing movement.

Diagram of the programming steps:

  • ->a-> distance ‘a’ move

  • rot+ (angle) counterclockwise rotation

  • rot- (angle) clockwise rotation

Example: Programming steps – analysing movement

Robot start, ->a-> , rot+( π /2), ->b-> , rot+( π – β), ->c-> , rot+(β), ->a-> , rot+( π /2), ->a-> ,

rot+( π /2), ->a-> , rot-( π /2), ->b-> , rot+( π /2), ->b-> , rot-+ (π /2), ->b->, rot-( π /2), ->c->,

rot+( π /2), ->c->, rot+( π /2), ->c->,

Programming - recommendation:

#!/usr/bin/env python3

from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B,OUTPUT_C, SpeedPercent, MoveTank //upload appropriate libraries

import math

tank_drive = MoveTank(OUTPUT_B, OUTPUT_C) //create object; we can manage both motors simultaneously

Calculating the necessary values

#!/usr/bin/env python3

c=math.sqrt(a*a+b*b) //we calculate the hypotenuse

beta=math.atan(a/b) //we calculate beta angle (currently in radian measure)

PI=math.pi //we convert pi into a constant

We make our work easier by using the following functions - example:

#!/usr/bin/env python3

def forward(length): // we create a function with a parameter (length) to move forward

  tank_drive.on_for_rotations(SpeedPercent(50), SpeedPercent(50), length)

def rotate(angle,orientation): //we create a function with two parameters (angle and orientation) to rotate through a certain angle in + or – direction

  tank_drive.on_for_rotations(SpeedPercent(-orientation*50), SpeedPercent(orientation*50), angle)

Angles alpha, beta and gamma and lengths a, b and c have to be multiplied by empirically defined factor in order for the rotation to be exactly 90 degrees (not more, not less). The same needs to be taken into account when we plan moves that make the robot return to the initial position.

Students write a programme on the basis of programme steps they have planned.

Next Section - The conic sections