# Calculate width and height of rectangle containing given area and conforming to given ratio.

My algebra is so rusty, this should be an easy one!

The area of a rectangle is

$$A = W \times H$$

If you're given $A$ (say $150$) and a ratio of $W:H$ (say $3:2$) how can you calculate $W$ and $H$?

Right so you have $W:H$ is $3:2$, which means $$150 = 3x \times 2x$$ So this is just a simple equation which you can solve for. That is $6x^{2}=150$ which says $x^{2} =25$ and hence $x =\sqrt{25}$ that is $x =5$. So $W = 3 \times 5 =15$ and $H= 2 \times 5 =10$ and you can see that they have ratio $3 : 2$.

• X=5 (then you get 3x * 5x = 15x10 = 150) - but you're showing X = 5 srt 2 - is that correct?
– Ryan
Commented Nov 18, 2010 at 23:42
• @Ryan: Edited now. Sorry made a egregious mistake
– anonymous
Commented Nov 18, 2010 at 23:50
• Cheers - skool is coming back to me after many years ;) Got stuck with simplifying 3x X 2x => 3 X x X 2 X x => 6x X x => 6x^2. Also found this algebrahelp.com/calculators/equation/calc.do?equation=150%3D3x*2x&solvf=AUTO
– Ryan
Commented Nov 19, 2010 at 0:02

I was looking for an answer for the same question. It's just that the other posts are kind of too complicated for me. I see it this way:

If you have given a width $a$ and a height $b$ and you know the $\textsf{area}$. You want to stretch each side with a fixed ratio of $x$ until you get the final size of the area. So you stretch $a$ with $x$ and $b$ with $x$ equals the $\textsf{area}$.

\begin{align*} (a\cdot x)\cdot(b\cdot x)&=\textsf{area}\\\\ (a\cdot b)\cdot x^2&=\textsf{area}\\\\ x^2&=\frac{\textsf{area}}{a\cdot b}\\\\ x&=\sqrt{\frac{\textsf{area}}{a\cdot b}} \end{align*} $x$ is the ratio you are stretching. So you can multiply $x$ by $a$ and $b$ to get the new size of $a$ or $b$.

Assume:

1. $ratio = \frac{x}{y}$
2. $area = x \cdot y$

So:

$x = y \cdot ratio$

Using substitution:

$area = (y\cdot ratio) \cdot y$

$area = y^{2} \cdot ratio$

$\frac{area}{ratio} = y^{2}$

$\sqrt{\frac{area}{ratio}} = y$

Now that you have y:

$x = \frac{area}{y}$

HINT $\rm\displaystyle\ \ \frac{W}H = \frac{3}2\ \Rightarrow\ 2\:W = 3\:H\:,\$ so $\rm\ 300 = 2\:W\:H = 3\:H\:H\ \Rightarrow\ H = \ldots$

• Bill - your hint has flummoxed me! ;)
– Ryan
Commented Nov 19, 2010 at 0:04
• @Ryan: What don't you follow? Commented Nov 19, 2010 at 1:42

For anyone else looking for an answer in the form of a formula that can be "plopped" into Microsoft Excel (or similar apps) here's what worked for me:

Let's say you have three named cells in Excel:

1. oldX : the current image width
2. oldY : the current image height
3. desiredArea : the desired area (x*y) of the image after resizing.
• For example, if you want the final area to be a scaled % of
the current area (areaScale eg., 0.5 for 50%),
then desiredArea = ( oldX * oldY * areaScale ).

...finally, you can calculate the new values for Y, then for X:

Formula for newY is =FLOOR( SQRT( desiredArea / (oldX/oldY), 1)

Formula for newX is =FLOOR( (oldX * oldY) / newY, 1 )

(This was my reinterpretation of LucasY's answer above.)