Basic Trigonometry


Hey y’all!

Today is Free Comic Book Day where famous comic story companies like Marvel and DC collaborate to distribute free comic books to thousands of stores nationwide!

Oh, you wanna go for a tan? Why? Oh, cos you want to sine some autographs?

Let us forget that I ever wrote that cringy sentence. Anyways, while some of us know this, others don’t: one of the paramount concept of geometry and math itself–trigonometry. This thread will cover the basics from the naming of the sides of a triangle to the law of cosines and sines. Additionally, although I won’t dive too much into them, I’ll also cover the three additional trig ratios (csc, sec, cot). Don’t worry if you don’t know those terms at all!

Trigonometry becomes a basic thing that most programmers need to understand, similar to how we all know basic math operations (addition, subtraction, multiplication, and division). While most things you’ll learn in this tutorial are applicable to Roblox, some may not be, but still deserve to stay since they’re part of the subject.

Disclaimer: :warning:

  1. You will need to know some algebra (i.e. solving equations).
  2. There may be cringy grammar or conceptual mistakes since this took me hours to write, so please be patient! DM me if you find any.

Section 1: Right Triangle Components

In trigonometry, the names of the sides matter a lot. Therefore, we need to get a good understanding of them.

  1. The side opposite of the right angle (blue) is always knowns as the hypotenuse. However, the two other sides, known as “legs”, (red and green) can vary in names depending on what angle you chose (excluding the right angle).

  2. In terms of the angle marked in yellow, the opposite side is a leg the angle faces towards (green). In other words, it’s the side that it’s not touching, the side that’s farthest from it.

  3. Also in terms of the yellow angle, the adjacent side is a leg that it touches (red). The hypotenuse does not count since it’s not a leg and has it’s own distinct name already.

Section 2: Labeling

  1. Since a triangle is a figure created from three points, a triangle can be named with any capital letters in any order (it doesn’t matter since it’s only three sides). The triangle above can be known as ΔABC (do not confuse the symbol with delta, it’s a triangle in this instance), ΔBAC, ΔCAB, or really anything from those three letters.

  2. There are two ways to name the sides of a triangle:

    • Using the lowercase letter of the point across from it (i.e side c is cross from point C).
    • Or by writing the names of the two points that create it (i.e. side AB spans from point A to point B)
  3. There are also two ways to name an angle (three technically):

    • Use the three-letter from one side of the angle-vertex-other side of the angle. For example, the orange angle can be ∠CAB or ∠BAC (any of them as long as the vertex “A” is in the middle).
    • A shorter way is to just name the vertex itself since there aren’t any other angles within. The orange angle can simply be called ∠A.
    • It is most commonly named Θ (theta), a Greek letter.
Section 3: Trig Ratios (sin, cos, tan)

Trig ratios are basically fractions of a side length divided by another side length (adjacent, opposite, and hypotenuse).

  1. The sine of Θ, noted as sin(Θ), represents the ratio the side opposite divided by the hypotenuse (i.e. sin(Θ) = a/c).
  2. The cosine of Θ, written as cos(Θ), is the side adjacent divided by the hypotenuse (i.e. cos(Θ) = b/c).
  3. The tangent of Θ, simply known as tan(Θ), is the side opposite divided by the side adjacent (i.e. tan(Θ) = a/b). This is a little different from the previous two as it does not involve the hypotenuse.

This can be challenging to remember, especially if you’re completely new to this, so until you get the hang of it, just remember:


Abbreviation of:
Sine Opposite/Hypotenuse
Cosine Adjacent/Hypotenuse
Tangent Opposite/Adjacent

Over time, you won’t even need this, it’ll be there in your brain just like that!

The sin, cos, and tan of a number will always remain the same. A calculator has these values precalculated and any decimal value is approximated because it falls between two whole numbers. You can do more research on this, it’s pretty cool in my opinion!

STOP :stop_sign: - Practice Time! :pencil2:

Using the concepts you learned so far, answer the following questions. Then, check your answers by revealing the spoiler next to/below it!


Question 1: What is the name of the side across from the right angle in a right triangle? Hypotenuse
Question 2: What is the sine of an angle (ratio of sides)? opp/hyp
Question 3: Use a calculator and your previous algebraic knowledge to solve the given problem. Make sure to set the mode to deg not rad as it will give a different result to sin, cos, tan! Round all answers to the tenths.


h = hypotenuse (the unknown side)
cos(25) = 5 / h
h * cos(25) = 5
h = 5 / cos(25)
h = 5.5

[CHALLENGE] Question 4: Express the ratio of tan in terms of sin and cos.

(Using the diagram from question 3)
tan(∠A) = a/b
sin(∠A) = a/c
cos(∠A) = b/c
We only need the a and the b, so how do we cancel out the c?
a/b = a/c * c/b = a/c ÷ b/c = sin(∠A) / cos(∠A) = tan(∠A)
So, tan(∠A) = sin(∠A) / cos(∠A).

Section 4: Inverse Trig Functions

So, now we can solve for sides using the trig ratios, but what if we were given two sides and we have to find the angle in between (for right triangles)? This is where the inverse counterparts of the three trig ratios come in:

They work very similarly to their normal counterparts. But, instead of putting in the angle measure, you put in the ratio of the sides corresponding to that trig ratio. For example, sin-1(a/c) because a/c is what sine is represented by.

If your calculator has sin, cos, tan buttons, then there’s bound to be their inverses in there as well! In the Google calculator (which I mostly use), the inverses are known as arcsin(), arccos(), and arctan() and they’ll appear in the place of the normal trig functions after pressing Inv:


STOP :stop_sign: - Practice Time #2! :pencil2:


There will only be one question, and here’s a hint, it’s about section 4!
Question 1: Find the measure of the angle. Round your answer to the nearest degree.

arctan(8 / 12) = 34°

Section 5: Special Right Triangles

There are “special” right triangles with certain degree measures that have very definite side lengths (relatively). When you encounter these triangles, you’ll be able to solve them much faster than using the trig ratios!

45-45-90 Triangle

  1. A 45-45-90 triangle has two 45° angles, meaning there are two congruent legs x (isosceles triangles).
  2. The hypotenuse is x√2.

Similarly, you can work backward: if the hypotenuse is x, then the legs are x / √2.

30-60-90 Triangle

This is a little more difficult to remember, but you’ll get the hang of it eventually!

  1. The side across from the 30° angle is x.
  2. Across from 60°, the side measure is x√3.
  3. The hypotenuse is simply 2x.

You can check with a calculator yourself if you want, and the values derived from using trig ratios and simply using special triangles will be the same.

Section 6: Pythagorean Trig Identity

In short, the Pythagorean trig identity is basically the equation above. Sine of theta squared plus cosine of theta squared equals 1.

And we’re going to prove it right now:

Why might this be useful, you may ask? Well, this equation is fundamental for unit circles, which is a whole new world of math and deserves its own tutorial :wink:.

STOP :stop_sign: - Practice Time #3! :pencil2:


Question 1: Solve the triangle below (find all angle measures and side lengths).


All triangles add up to 180, so m∠B = 180° - 90° - 30° = 60°
What do you know? It’s a 30-60-90 triangle!
Since b is across from 60° angle, a must be 5 / √3 = (5√3) / 3.
c must be 2 times a, which is (10√3) / 3.

Question 2: If sin^2(Θ) = 0.36, find cos(Θ).

According to the Pythagorean Trig Identity, sin^2(Θ) + cos^2(Θ) = 1:
0.36 + cos^2(Θ) = 1
cos^2(Θ) = 0.64
cos(Θ) = 0.8

Section 7: Law of Sines

  1. This applies to ANY type of triangle, whether or not it’s right, Law of Sines doesn’t care.
  2. The ratio of the side length divided by the sine of the opposite angle is the same for all three sides of a triangle.
  3. The reciprocal is also true.

This law is useful when you’re finding a side or angle and you’re given the opposite side/angle and one pair of side-angles. For example, if you’re finding side b, and you’re given m∠B, side c, and m∠C, then you can use the Law of Sines.

Section 8: Law of Cosines

Just like the Law of Sines, the Law of Cosines works with any triangle.

This may seem complex at first, so, here’s the general formula:

Note: angle1 is between side2 and side3. Law of Cosines can only be used when you have the angle in between the two sides to the right of the equation (if that makes sense).

This is primarily useful when you are given three sides of a triangle, but you’re finding a certain angle. Or if you’re given an angle and two sides that create that angle, and you’re finding the opposite side. For example, if you’re given side b, side c, and m∠A and you’re trying to find side a.


When you are given SAS (a side, an angle in between, and another side adjacent to it), you need to use a combination of both Law of Sines and Cosines. First, doing the Law of Cosines will give you the side across from the given angle, meaning you can now use the Law of Sines to set a proportion with that angle-side pair and an unknown angle with the side across from it.

BUT, beware! You must find the smaller angle! And remember, to find the smaller angle of the two unknown ones, just look at the side length across from it. Choose the angle in which the side length across from it is less than the side length across from the other unknown angle. We’ll see this in action in Practice 4 Question 3!

For more info, please read my reply.

STOP :stop_sign: - Practice Time #4! :pencil2:


Question 1: Solve for m∠A in degrees. Round to the nearest whole.


It will be easier to set it up with sine at the numerator and the side at the denominator.
sin(48) / 7 = sin(∠A) / 9
9 * sin(48) / 7 = sin(∠A)
sin-1(9 * sin(48) / 7) = m∠A
m∠A = 73°

Question 2: Find the unknown side. Round your answer to the nearest tenth.


a^2 = 8^2 + 7^2 - 2 * 8 * 7 * cos(37)
a = √(64 + 49 - 112 * cos(37))
a = √(113 - 112 * cos(37))
a = 4.9

[CHALLENGE] Question 3: Solve the triangle. Find all sides and angles. Round lengths to the nearest tenth and degrees to the nearest whole number.


Using the Law of Cosines:
c = √(256 + 25 - 32 * 5 * cos(61))
c = √(281 - 160 * cos(61))
c = 14.3
Using the Law of Sines (remember smaller angle first (B), meaning the one across from side with length 5):
sin(61) / 14.3 = sin(B) / 5
5 * sin(61) / 14.3 = sin(B)
sin-1(5 * sin(61) / 14.3) = m∠B
m∠B = 18°
Angles in a triangle add to 180:
m∠A = 180° - 61° - 18° = 101°

Section 9: More Trig Functions (csc, sec, cot)

As I said thousands of words yonder, I will not go very deep into this. At this point, the line between trigonometry and calculus are blurred. But, I thought I’d show it to you anyways.

  1. Cosecant, written as csc, is the reciprocal of the ratio that is a sine. Don’t get this confused with this being paired with cosine because it has “co-” in it, it belongs with sine!
  2. Secant, noted as sec, is the reciprocal of cosine.
  3. Cotangent, also known as cot, is the reciprocal of tangent.

You can research more about them if you want, but the basics of trigonometry end right here, I’m afraid :frowning_face:.

Application to Roblox
--(must provide radians)
math.sin(math.rad(degrees)) --sine 
math.cos(math.rad(degrees)) --cosine 
math.tan(math.rad(degrees)) --tangent 

--(returns radians)
math.deg(math.asin(ratio)) --inverse sine 
math.deg(math.acos(ratio)) --inverse cosine 
math.deg(math.atan(ratio)) --inverse tangent 

--(trig in math functions), y, z):Dot(, b, c)) --|a| |b| * cos(Θ)
--more that I may not know about :)

For the last one, make sure you check out @BuilderBudCarl vector mathematics tutorial, it’s very in-depth and informational!

So, I hope you found this tutorial useful. As I mentioned before, some concepts like sin, cos, tan, arcsin, arccos, arctan, may be much more useful to Roblox development than concepts such as the csc, sec, and cot. It really depends since trigonometry is a vast subfield, just like math itself.


How useful is this tutorial (and/or the information inside of it) to you? Please rate from 1-10.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

How clear was the information conveyed? Rate from 1-10.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

Did you learn anything new? Even a single concept that I didn’t cover majorly.

  • Yes
  • No

0 voters

Feel free to share comments, concerns, or questions via replies!

Thank you for reading (if you didn’t skip) and your feedback,
and have a trigonometric day!

Topic Edits

Sat, May 2, 2020:

  • Corrections

Sun, May 3, 2020:

  • More fixes
  • Cringy pun addition at the beginning (you’re welcome)
  • The addition of this topic edits drop-down

Sat, Nov 28, 2020:

  • Added NOTES section right after Law of Sines & Cosines (please view it if you haven’t already!)

Nice tutorial. (When you edited the topic it made me go back to the top)

As a beginner, this helped me out alot. I hope to see more tutorials from you in the future.


Thank you!

I was just reading through myself and making corrections. Sorry for the inconvenience!


This actually kinda helped me on the exam i am about to take, Thank you :smile:


Good luck! Roblox coding actually teaches a lot of stuff surprisingly.


Cool tutorial on geometry. This could help people on their exams.
I like how Roblox teaches people how to do mathematics.


Ssh, don’t tell your teacher about this though!

In all seriousness, I’m glad you found this useful and good luck!


This is honestly a good refresher for me going back to the basics of trigonometry. Great tutorial!


Still cannot understand the use of trigonometry, and where sine,cosine and tangent are used.
I’d suggest improving this lesson to make it dummy friendly.

It was an amazing post and I highly support the idea of making math lessons here on the devforum, since a good amount of developers don’t have a good understanding in math, and some of them don’t know how to use it in their games.


I also thought about adding example use cases of trigonometry in Roblox, but the thread has gotten very long already. Plus, this was more of an informational tutorial and my intention was to teach everyone about the concept, but people themselves chose when and where to use it. After all, programming and developing is your creative spin-off of what you learned. I mainly want to make sure that everyone does get a good understanding of this subject.

However, if it does become a requested thing, then I might consider making another tutorial talking about the application of trigonometry in Roblox. :wink:


Yes please do it. I’m interested to see how trigonometry can be applied in roblox.


If you do it, you will have all my respect


I’m sure I can think of countless ways to apply trig to developing on roblox, but I’m very curious to see what you’d come up with! I’ll be tracking this thread in hopes that you post more ways to apply it :wink:

Side note, awesome stuff!

1 Like

Heya! I myself am a newbie to the absolute beast that is trigonometry and I struggle myself with understanding it but I think I’ve grasped a bit of it to maybe help clear up some confusion(Anyone feel free to correct me if I’m wrong at any point in this post)

To start off Trigonometry focuses on the relationships within the sides and lengths of the right triangle and therefore can be used to solve for unknowns in the triangle.

I think trigonometry is just based on what you’re trying to find, and by using what you already know you can utilize the trigonometric functions to find an unknown value, it could be an angle or the length of a side…

Let’s say we have this right angle triangle:

Now let’s say we know what angle A is and we know what side a is and we’re trying to find side b, well then what should we do to find side b?

When doing trig depending on the angle you’re inputting into your function all your sides will be relative to that angle, what do I mean by this?

Well if we’re using angle A then the opposite side would be c because it is directly opposite from angle A and side b would be the adjacent side because it is adjacent to angle A, but Syh isn’t side a adjacent to angle A as well? good question but you see side a would be the hypotenuse, why you ask? because it is the side directly opposite to the 90 degree angle. So remember that.

Now, now that we know our angle and side, how do we find side b?, well since side b is adjacent to angle A we should use cosine (Cosine is Adjacent over Hypotenuse) or CAH for short.

We’re using cosine because we want to find the adjacent side, and since cosine returns the ratio of the adjacent side to the hypotenuse, since we know the length of the hypotenuse(side a) we could just multiply that ratio to return the actual length of the side we’re trying to find i.e side b… let’s demonstrate.

let’s plug cosine(A) into a calculator

our answer:

Alas my friends we have found our ratio value this is essentially b/a, but remember we didn’t know what b was, so now how do we find it?

Algebra version:
we can multiply our ratio by the side we know to find the side we want that’d look like this:

don’t mind the numbers they’re just showing the steps in sequential order
In step 3 we cancelled out side a from the equation and were left with b in step 4.

some people may not be strong at algebra so here’s a simplified version of us multiplying the ratio by the side a to find side b with the values:

and now as you can see we were left with this long decimal value, that is in fact side b.

So this is really just the basics I tried to break it down as much as possible so it could be easy to understand and as well as provide many visual examples.

The same concept for cosine applies for all the trigonometric functions, such as tan, sine, and cosine… later I might post a follow up on how to actually use and apply the inverse trigonometric functions such as asin, acos and atan, these functions are more widely used in game development due to their ability to find unknown angles which is really useful and important especially in game development.


Thanks this cleared up some of my confusion!

1 Like

Yes please make a tutorial as well :grin: :grin:

1 Like

Hey there! Awesome job with your go at trigonometry even though you’re new to it.

The only thing I have to mention is that you labeled the triangle a little incorrectly. The side that is c right now is supposed to be side a since it’s across from angle A. You just need to switch the current side a and side c. But, it really doesn’t matter much, I just I’d let you know as an FYI since that is the standard style of labeling triangles in trigonometry, you know?

1 Like

Wish there was an amazing resource like this 5 years ago


This is RealMathGeek approved!


This helped me a lot, thanks!
By the way, I think the answer for Question #2 in Practice #4 is wrong, as it is in radian. It should be 4.8 (or 4.9).
One thing I don’t get is Q#3 of Practice #4. I used the Law of Sines to find angle A an got 78, and 78 + 61 = 139. 180 - 139 = 41 for angle B. But you used the Law of Sines to find angle B first and got different answers?

1 Like