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.



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$.