2 rectangles and 1 square I need a solution in algebraic form. I have $2$ rectangles and $1$ square. $2$ rectangles are place vertically to each other and horizontally in front of the square. I need to scale them in a way that 


*

*All interim space between rectangles and squares is occupied

*Square should not lose its aspect ratio(means it should remain square)

*$2$ of the rectangles also retain their aspect ratios

*However the height can be increased for both rectangles and square but they should aligned from top and bottom.


I have a rough design 

 A: Okay.
Rectangle 1: is $a \times b$
Rectangle 2: is $c \times d$ 
And square 3: is $e\times e$.
So .... scale: 
Keep triangle 1: to be $a \times b$
Scale rectangle 2': so that the width $c$ scales to $a$.  That is scale by $\frac ac$.  So rectangle is $a \times d*\frac ac$ or $a \times \frac {da}c$ 
And the side of the square: The heights of the rectangles are $b$ and $\frac {da}c$.  So the side of the square needs to be $b+\frac {da}c$..... so make it $b+\frac {da}c$.
A: This requires the solution of two linear equations in two variables.


*

*Rectangle 1: width $w$, height $h$

*Rectangle 2: width $W$, height $H$

*Square: side $S$


One wishes to scale the two rectangles by factors $x$ and $y$ such that


*

*$wx=Wy$

*$hx+Hy=S$


So solve
\begin{eqnarray}
wx-Wy&=&0\\
hx+Hy&=&S
\end{eqnarray}
for $x$ and $y$
This is easily solved to give
$$x=\frac{WS}{wH+Wh}\qquad y=\frac{wS}{wH+Wh}$$
The entire result can then be scaled further by any factor required.
A: Save yourself the trouble of dealing with fractions until the end.
Suppose you have rectangles with (width-by-height) dimensions $a\times b$ and $c\times d$.

Get a common width by scaling the first rectangle with a scale factor equal to the full width ($c$) of the second, and then scaling the second rectangle with a scale factor equal to the full width ($a$) of the first.

The resulting rectangles have a combined height of $ad+bc$, which becomes the required side-length for your square.
From here, you can scale the entire figure however you like. In particular,


*

*If you are trying to hit a target width of $w$, scale by
$$\frac{w}{ad+bc+ac} \qquad\left(=\frac{\text{target width}}{\text{total width}}  \right)$$

*If you are trying to hit a target height of $h$, scale by 
$$\frac{h}{ad+bc} \qquad\left(=\frac{\text{target height}}{\text{total height}}\right)$$

