Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My goal is to create a rotated rectangle with a size to my specification. I begin with a regular rectangle which gets rotated 45 degrees.

Now I know I have succeeded to calculate the width and height after the rotation using;

rotatedSize = (sin(0.785398163) * originalSize) * 2;

So when I want a rotated rectangle of 100x100 my formula is;

100 = (sin(0.785398163) * originalSize) * 2;

Now I am not very good at math but I know there is a way to solve this formula, can anyone assist me in solving it?

share|cite|improve this question
up vote 1 down vote accepted

You need $\sin \frac{\pi}{4}=\frac{\sqrt{2}}{2}\approx 0.707\ $, so originalsize$=\frac{100}{\sqrt{2}}\approx 70.71$

share|cite|improve this answer

Solving for $\text{originalSize}$ can be done by division: $$\text{originalSize}=\frac{100}{2*\sin(0.785398163)}.$$

This is because your formula really says that $$100=(\text{originalSize})*(2*\sin(0.785398163))$$ (I gathered together the two numbers that $\text{originalSize}$ was multiplied by to get $100$.)

For the particular angle $\pi/4$ that we are looking at, the sine is exactly $1/\sqrt{2}$, so the bottom simplifies to $\sqrt{2}$. And then a little further manipulation (multiply top and bottom by $\sqrt{2}$) yields $50\sqrt{2}$. To the limit of precision of my calculator, this is $70.710678$.

share|cite|improve this answer
Andre, could you explain this answer a bit more for people searching for this? Where does the 2 come from and why? It seems the above Is there a more general formula to get original width and height of any sized rectangle? – Simon Sarris Aug 29 '11 at 20:52
@Simon Harris: It might be interesting for graphics programmers to know how we get the formula for space occupied when an $a\times b$ "horizontal/vertical" rectangle is rotated by $\theta$. However, that's not the question that was asked here, what was asked was basic algebra. If I answered here a question that wasn't asked, the result would be buried. I suggest that you post the relevant question, in whatever level of generality you wish, including specification of centre of rotation. There will be answers, including mine if I am quick enough! – André Nicolas Aug 29 '11 at 22:11
Okay, I have posted the (somewhat related) question:… – Simon Sarris Aug 30 '11 at 14:11
@Simon Harris: And, as promised, I have posted an answer. Naturally, I was not first to post an answer. But on seeing the other answer, I decided that mine was different enough (though roughly equivalent) to be worth posting. – André Nicolas Aug 30 '11 at 15:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.