# Custom bar top calculus - largest diagonal rectangle

We're building a custom bar and one of the last steps is placing the bar top on. To make it unique we want to cut a piece of butchers block diagonally to fit the width needed (15.25 inches). Its a narrow "mini" bar. The butchers block is PV=34.25 inches by PR=49.5 inches. We're nerds but we're frugal. We want to cut the largest diagonal piece of the butchers block we can for the needed width. We've laid out the problem below. Given that:

$b = 15.25$

$PV = 34.25$

$PR = 49.5$

Assume also that the center of rectangle a x b is also the center of rectangle PR x PV.

$WP = ST$

$PQ = UT$

Solve for WP an PQ.

angle t = unknown but maximum possible

side a = unknown but maximum possible

There is another similar question See "Given a width, height and angle of a rectangle, and an allowed final size, determine how large or small it must be to fit into the area" but it does not quite ask or answer the same thing.

• So you want WP and PQ for a maximized QU=WS? Or is it for a maximized area WQ*WU? – Bobson Dugnutt Aug 21 '16 at 0:00
• I would say that your question is vague and needs major clarification. However, if I understand the question correctly, there is no maximum $QU=WS$, unless you accept degenerate rectangles. If degenerate rectangles are OK, then it is obvious that $W=P=Q$ and $U=T=S$ give the maximum $QU=WS$. – Batominovski Aug 21 '16 at 0:04

The longest rectangle with given width $b=15.25$ that can be inscribed in your butcher's block and that shares the same center will have all its corners touching the sides of your block, because any rectangle that doesn't can be rotated slightly and then elongated to fill the gap.
So there are two candidates for optimality: a diagonally placed rectangle, or one that is parallel to the longer side of your block. For the diagonally placed rectangle, we have two constraints, using the notation in your diagram: By Pythagoras, $$(49.5-QR)^2 + (34.25-RS)^2 = b^2=15.25^2,$$ and by similar triangles, $$\frac {QR}{RS}=\frac{34.25-RS}{49.5-QR} .$$ Solving these, we get $QR=42.9324$ and $RS=20.4867$ (the other solution is spurious), and therefore the length of your optimal diagonally placed rectangle is $\sqrt{QR^2+RS^2}=47.57$. This is shorter than the longer side $PR=49.5$ of your butcher's block, BTW.