How to find the scaling factor of a rotated rectangle circumscribing another rectangle of same size? Suppose rectangle 1 with length $l$, and width $w$, which has a center $C$ (where the diagonals intersect), rectangle 2 with same length $l$, width $w$, and center $C$, but rotated $\theta$ radians across $C$. How do you find the scaling factor $S$ of rectangle 2 around $C$ such that rectangle 2 circumscribes (It won't matter to me if only 2 of the vertices are being touched as long as rectangle 1 is fully inside rectangle 2, and the scaling is done exactly around center $C$.) rectangle 1?
I searched for this question but with squares and the answer was $\sin{\theta}+\cos{\theta}$, but this answer doesn't work with rectangles.
 A: Instead of rotating rectangle 2 (R2) by $\theta$ we can rotate rectangle 1 (R1) by
$-\theta$
If we use $a=l/2, b=w/2$ then coordinates of R1 vertices before the rotation
are $(\pm a, \pm b)$.
After the rotation we only need (because of symmetry) to look at the rotated $(a,b)$
and (a,-b):
$$
\left(
\begin{array}{rr}
  \cos\theta & \sin\theta\\
  -\sin\theta & \cos\theta
\end{array}
\right)
\left(
\begin{array}{c}
   a \\ \pm b
\end{array}
\right)
=
\left(
\begin{array}{c}
   a\cos\theta\pm b\sin\theta\\
   -a\sin\theta\pm b\cos\theta
\end{array}
\right)
$$
The minimal scales $s_x,s_y$ in X and Y direction respectively must be:
$$
s_x =  \max\left(
\frac{|a\cos\theta + b\sin\theta|}{a},
\frac{|a\cos\theta - b\sin\theta|}{a}\right)
$$
$$
s_y =  \max\left(
\frac{|-a\sin\theta + b\cos\theta|}{b},
\frac{|-a\sin\theta - b\cos\theta|}{b}\right)
$$
Note that we can replace $a,b$ by $l,w$ since they are both scaled by 1/2.
To get one R1 completely inside R2 the minimal uniform scale is
$$ s = \max{(s_x, s_y)}$$
A simpler way to express the above formulae:
$$
s = |\cos\theta| + \frac{b}{a}|\sin\theta| \;\;\;\mbox{if}\;\;\;a\leq b
$$
$$
s = |\cos\theta| + \frac{a}{b}|\sin\theta| \;\;\;\mbox{if}\;\;\;b\leq a
$$
-- or even simpler if we use $r = \max \left(\frac{a}{b}, \frac{b}{a}\right)$:
$$s = |\cos\theta| + r|\sin\theta|$$
A: Let $a= \ell/2$, let $b = w/2$, and let the coordinates of the center $C$ be $(0,0).$ 
Let's also keep the $x$ and $y$ axes on the axes of the circumscribed rectangle. That means working in a rotated coordinate system most of the time or considering the inner rectangle to be the one that is rotated.
I find the latter simpler to visualize, so let's do that.
Then the upper right corner of the original rectangle is at $(x,y) = (a,b)$.
If the rectangle is rotated through an angle $\theta$ counterclockwise,
the upper right corner's $y$ coordinate becomes $b \cos \theta + a \sin \theta.$
When $0 < \theta < \frac\pi2,$ the (rotated) upper right corner is the highest point of the rotated rectangle and therefore determines that the $y$-coordinate of the top edge of the circumscribed rectangle must be at least $b \cos \theta + a \sin \theta.$
Since the $y$-coordinate of the unscaled rectangle is $b,$ this implies the rectangle must be scaled up by at least the factor $\cos \theta + \frac ab \sin \theta.$
Similarly, the lower right corner of the original rectangle is at $(x,y)=(a,-b),$
and its $x$ coordinate after rotation becomes $a \cos\theta + b \sin\theta,$
requiring the $x$-coordinate of the right edge of the circumscribed rectangle to be
$a \cos\theta + b \sin\theta$ when $0 < \theta < \frac\pi2.$
This implies the rectangle must be scaled up by at least the factor
$\cos\theta + \frac ba \sin\theta.$
If $a \geq b$ then the first formula gives a greater scaling factor, that is, the circumscribed rectangle is determined by where its top edge rests on a corner of the rotated rectangle. If $b \geq a$ the circumscribed rectangle is determined by where its right edge touches a corner of the rotated rectangle.
But if we continue to rotate the original rectangle, each corner of the rectangle in turn touches the top edge of the circumscribed rectangle (if $a \geq b$) or the right edge of the circumscribed rectangle (if $b \geq a$).
This means the formulas $b \cos\theta + a \sin\theta$ and
$a \cos\theta + b \sin\theta$ are repeated with all four possible combinations of signs on $a$ and $b.$ Since the size of the circumscribed rectangle is always determined by which of the four corners is uppermost (if $a \geq b$) or rightmost (if $b \geq a$),
we have to consider the worst-case combination of signs at all times.
This gives us the formulas $b \lvert\cos\theta\rvert + a \lvert\sin\theta\rvert$
and $a \lvert\cos\theta\rvert + b \lvert\sin\theta\rvert,$
corresponding to the scaling factors
$$
\lvert\cos\theta\rvert + \frac ab \lvert\sin\theta\rvert
\quad\text{and}\quad \lvert\cos\theta\rvert + \frac ba \lvert\sin\theta\rvert.
$$
We have to scale up by whichever factor is larger in order to circumscribe an unrotated rectangle around the rotated rectangle, so the scaling factor works out to
$$
\lvert\cos\theta\rvert + \max\left\{\frac ab, \frac ba\right\} \lvert\sin\theta\rvert.
$$
Of course if you know in advance that $a \geq b$ (that is, that the length of the rectangle will be greater than its width), you can simplify the formula by replacing
$\max\left\{\frac ab, \frac ba\right\}$ by $\frac ab.$
Here is an interactive demonstration of the formula.

Note that for a square, where $a = b,$ the scaling factor that works for all angles of rotation (not just between $0$ and $\frac\pi2$) is
$$
\lvert\cos\theta\rvert + \lvert\sin\theta\rvert.
$$
Without the absolute values, the factor $\sin\theta + \cos\theta$ decreases to zero when $\theta = \frac34\pi$ and is negative when $\theta = \pi,$ and so is clearly not a correct scaling factor in either of those cases.
