$x = \frac{1}{2}(w - b) \cos \theta$
$h = \frac{1}{2}(w - b) \sin \theta$
$A_1 = bh$
$A_1 = \frac{1}{2}b(w - b) \sin \theta$
$A_2 = \frac{1}{2} xh$
$A_2 = \frac{1}{2} [\, \frac{1}{2}(w - b) \cos \theta \,] [\, \frac{1}{2}(w - b) \sin \theta \,]$
$A_2 = \frac{1}{8}(w - b)^2 \sin \theta \cos \theta$
$A = A_1 + 2A_2$
$A = \frac{1}{2}b(w - b) \sin \theta + 2 [ \, \frac{1}{8}(w - b)^2 \sin \theta \cos \theta \, ]$
$\dfrac{dA}{d\theta} = \frac{1}{2}b(w - b) \cos \theta + \frac{1}{4}(w - b)^2 (\cos^2 \theta - \sin^2 \theta)$
$2b \cos \theta + (w - b) [ \, \cos^2 \theta - (1 - \cos^2 \theta) \, ] = 0$
$2(w - b) \cos^2 \theta + 2b \cos \theta - (w - b) = 0$
By quadratic formula:
A = 2(w - b); B = 2b; C = -(w - b)
$\cos \theta = \dfrac{-B \pm \sqrt{B^2 - 4AC}}{2A}$
$\cos \theta = \dfrac{-2b \pm \sqrt{(2b)^2 - 4[2(w - b)][-(w - b)]}}{2[2(w - b)]}$
$\cos \theta = \dfrac{-2b \pm \sqrt{4b^2 + 8(w - b)^2}}{4(w - b)}$
$\cos \theta = \dfrac{-2b \pm 2\sqrt{b^2 + 4(w - b)^2}}{4(w - b)}$
$\cos \theta = \dfrac{-b \pm \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$
$\cos \theta = \dfrac{-b + \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$ and $\dfrac{-b - \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$
$\cos \theta = \dfrac{-b - \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$ → meaningless
Use
$\cos \theta = \dfrac{-b + \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$
$x = \frac{1}{2}(w - b)\cos \theta$
$x = \frac{1}{2}(w - b) \times \dfrac{-b + \sqrt{b^2 + 4(w - b)^2}}{2(w - b)}$
$x = \frac{1}{4} \left[ -b + \sqrt{b^2 + 4(w - b)^2} \right]$
$a = b + 2x$
$a = b + 2 \Big\{ \frac{1}{4} \left[ -b + \sqrt{b^2 + 4(w - b)^2} \right] \Big\}$
$a = \frac{1}{2} [\, -b + \sqrt{b^2 + 4(w - b)^2} \,]$ answer