Squaring Decimals - Why it is 2.5^2 in the example?

I dont understand in the Squaring Decimals lesson why the cube with 2.5 row size is 2.5^2, if the row is 2.5, the height should be 2.5 too, why in this case its not 2.5^2.5?
Also what to do if the size of height is different from the width?

Great question @Ataos.

When you think about the area of a rectangle, we can calculate this as area = width * height.
A square is just a special case for a rectangle, where the width and height are the same.

This means that we’re multiplying a single side length by itself and, when we do this, we raise it to the second power.
So if you have a square with side lengths of 2.5 x 2.5 you can also say that;
2.5 * 2.5 = (2.5)^2 = 6.25.

I’d encourage you to plug this into a calculator to confirm that the numbers are correct and also try with some other numbers as well.

To take this to the next level, when we cube a number we multiply it by itself 3 times because the width, height, and depth are all the same on a perfect cube.
So with our example we would get;
2.5 * 2.5 * 2.5 = (2.5)^3 = 15.625

Going back to 2D - if the width and height of your rectangle are different then you’re no longer dealing with a square number and you’d just multiply the two different sides together normally.

My response in this thread may also help, so feel free to give it a read:
https://community.gamedev.tv/t/squaring-decimals/157130

If you’re still struggling, or have any other question, please let me know.

1 Like

thank you for the reply and explanation, now I can understand.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms