top of page
  • Writer's pictureEmily Shepherdson

TrigonometrYYYY?

Updated: Jun 1, 2018

Why do you need to know the cosine law or the Pythagorean theorem? Who cares what type of triangle it is, right? WRONG!

Understanding trigonometry basics can go a long way. From determining the proper angle and lengths when you're building pretty much anything (i.e. deck, flower box, picture frame, drywall trim) to designing code to control a robotic arm!


As with any math or scientific principle, a good understanding of the basics will set you apart from your peers once you can use it to solve complex problems.


Why can't I just use the computer?

Well, you can but if you are coding software I can guarantee the computer will not be processing the data as efficiently as it could. Additionally, exams are still written by hand, the further you get into your studies, being able to simplify trigonometric functions will make things easier for you in the end. Ok, let's get started.

Pythagorean Therom

First, let's do a quick recap of the math! The Pythagorean theorem is incredibly useful to describe relationships between the math and physics behind some interesting real-world systems such as robots for example.


The Pythagorean theorem allows you to calculate the length of one side of a triangle if the other two sides are known.


The theorem is derived from the bases that the combined area of the two smaller squares (a and b) have the same area of the bigger square (c). The area of a square is the length times the width, and for squares the length equals the width (i.e. a x a, b x b)... kinda neat!


Along with the Pythagorean theorem come some trigonometric functions which use information that is known about an angle in the triangle to determine missing information.

SOH CAH TOA

What is this mystery information?

Why don't we already know it and how come I need to solve it using trigonometry?


Well unfortunately sometimes examples provided in school are vague to get you to practice specific techniques. In robotics being able to understand the relationships between arm links and joints allow us to know information even if the arm changes position. Below you can see an example of a robot with a 2-link manipulator arm.

Robotic Arm and Trigonometry

To understand the relationships between the arm links, we need to look at the problem in the x and y-direction separately. Starting with the x-direction, we can sum the cosine component of each triangle and add them together as follows:

Next, we sum the sine components which describe the y-direction. In this case, since the robot's arm starts up at the shoulder we need to also account for this initial height (y0) which is only in the y-direction:

Now we have described the x and y components of the system in terms of the robots links and joint angles. This type of formulation is called Forward Kinematics. However, the Forward Kinematics equation isn't necessarily beneficial on its own because we would need to be given the two angles to know where the robot's hand ends up in the x and y coordinates. A more useful equation would let us pick the x and y coordinates and calculate the necessary angle to get there.


WARNING: there is a lot of math coming but don't worry. I am going to do my best to walk you through step by step so you can see all of the valuable trigonometry needed to calculate arm positions for a robot!

Going back to our good old friend Pythagoras, if we are given a final destination for the robot's hand in x and y coordinates, we can calculate the distance:

Earlier we established equations for x and y, so we can substitute them into the Pythagorean Theorem and solve using trigonometric identities and algebra, how exciting! Haha!

The substitution is as follows:

Expanding out the quadratics leaves us with the below equation:

The equation looks big and scary, BUT we know x, y and the lengths of the arm links, so the only unknown information is the two angles. Before we move forward, we can use some trigonometric identities to simplify our equation to a much more manageable size. This is where I need you to trust me and stick with it to the end! First I've rearranged the equation to group like terms which will show where we might be able to start simplifying.

The first and second terms in the equation have a very nice Pythagorean identity that can allow us to remove the angle components. The Pythagorean Identities are as follows:

Using the first identity to simplify the first and second terms in our robot equation leaves us with a simplified equation as follows:

Now, let's tackle the final term, which can be simplified to include the second angle only. To simplify I need to introduce the Angle Sum and Difference Identity:

The second identity should look similar to the final term in our equation.

Wooo! We are almost there! I hope you aren't reading this before bed because the excitement will keep you up all night! :)


There is one last identity that I will share to make our final simplification, and that is the Reflection Identity:

Using the reflection identity, we can now solve for the second angle:

The plus/minus in the sine term indicates that there are two solutions to this problem. We will only be looking at the positive case for simplicity. Now, the final step is to solve for the first angle. Let's look at the problem again zoomed in.

The blue triangle shows the big picture from the first joint to the robot's hand which ends in coordinates (x,y). We can find the angle of the blue triangle using basic trigonometric functions: TOA.

Additionally, the angle of the blue triangle can be described by the sum of two other angles and rearranged to solve the final part of our equation. The process is outlined below:


WE MADE IT!!

I know that was a lot of math, but when I was younger, I always wished I knew why I was doing the same type of calculations in math or science class over and over again. I thought this was a great example to demonstrate real world application of trigonometry! When I do work on designing navigation and control techniques for teams of space robots I need to make sure the calculations are as efficient as possible, so I always simplify my kinematic equations by hand, before I put them through my simulation.


Do not feel bad if you didn't fully understand the method, everyone learns differently, plus this is a simplified example from a University level course so absolutely no reason to feel concerned. I wanted to showcase how you can use the math and science initially taught in high school to do some pretty cool things! #theSKYisNOTtheLIMIT


To summarize, trig is important! With hard work, practice and some imagination you can do anything! I hope you learned something from this post. Please subscribe to my e-mail list or follow me on Facebook, Twitter or Instagram to get updates on my next posts!



167 views0 comments

Recent Posts

See All
bottom of page