<s>[INST] Calculate side lenght of triangle from two rectangle on top of each other I want to calculate the side lenght of $b$. I have two rectangles with one at 0° (screen) and I have one rectangle at 20° (turned image). With respect to the middle point. Both rectangles have a height of 6 and a width of 8.
Beceause the image is rotated, there will be black triangles in the corners of the screen. Now I want to calculate the lenght of $B$, as showed on the drawining. How can I do that?

 [/INST] Using the center where you've drawn the dot as the origin, and letting $c \approx .940$ and $s\approx .342$ denote the cosine and sine of $20$ degrees, respectively, the equation of the top horizontal line is 
$$
y = 3,
$$
and the equation of the tilted top line is 
$$
\pmatrix{-s \\ c} \cdot \pmatrix{x\\y}  = 3,
$$
which is 
$$
-sx + cy - 3 = 0.
$$
To compute the intersection, we plug in $y = 3$ into the second equation, getting
$$
-sx + 3c - 3 = 0 \\
3(c-1) = sx \\
\frac{3(c-1)}{s} = x
$$
so that 
$$
(x, y) \approx (-0.530, 3)
$$
is the intersection point on the top edge. 
Doing the same for the left edge, whose equation is 
$$
x = -4,
$$
we get 
$$
4s + cy - 3 = 0 \\
cy = 3 - 4s \\
y = \frac{3 - 4s}{c} \approx \frac{3 - 4\cdot .342}{.940} \approx 1.737
$$ 
so that the left-hand intersection point is at
$$
(x, y) \approx (-4, 1.737). 
$$
In short form: 
Assuming inches, the top intersection is about .53 inches to the left of the middle of the top of the card; the left-hand intersection is about $1.74$ inches above the middle of the left edge of the card. 
Now..about that length that you asked for: it's the distance between the two points. So we need to compute
\begin{align}
d 
&= \sqrt{ (x_1 - x_2)^2 + (y_1 - y_2)^2 } \\
&= \sqrt{ (-0.53 - (-4))^2 + (3 - 1.737)^2 } \\
&\approx 3.693
\end{align}
If you want an exact formula, that'd be 
\begin{align}
d 
&= \sqrt{ (x_1 - x_2)^2 + (y_1 - y_2)^2 } \\
&= \sqrt{ (\frac{3(c-1)}{s} - (-4))^2 + (3 - \frac{3 - 4s}{c})^2 } \\
&= \sqrt{ (\frac{3(c-1)}{s} + 4)^2 + (\frac{3c}{c} - \frac{3 - 4s}{c})^2 }\\
&= \sqrt{ (\frac{3(c-1)}{s} + \frac{4s}{s})^2 + (\frac{3c}{c} - \frac{3 - 4s}{c})^2 } \\
&= \sqrt{ (\frac{3(c-1) + 4s}{s})^2 + (\frac{3c - 3 + 4s}{c} )^2 } \\
&= \sqrt{ (\frac{3c- 3 + 4s}{s})^2 + (\frac{3c - 3 + 4s}{c} )^2 } \\
&= \sqrt{ \frac{(3c- 3 + 4s)^2}{s^2} + \frac{(3c - 3 + 4s)^2}{c^2}  } \\
&= \sqrt{ \frac{(3c- 3 + 4s)^2 c^2}{s^2 c^2} + \frac{(3c - 3 + 4s)^2s^2}{s^2c^2}  } \\
&= \sqrt{ \frac{(3c- 3 + 4s)^2 (c^2+s^2)}{s^2 c^2}} \\
&= \sqrt{ \frac{(3c- 3 + 4s)^2}{s^2 c^2}} \\
&= \frac{|3c- 3 + 4s|}{s c} 
\end{align}
Plugging that into an online calculator, I get $d \approx 3.69378132923$.
</s>