Encounter the definite integral below while integrating an enclosed area in polar space
$$\int_{\tan^{-1}\frac12}^{\frac\pi4} \left(\sin x+\cos x-\sqrt{\sin 2x}\right)^2dx=\frac15-\tan^{-1}\frac17 $$
Figured out the clean result on RHS from the geometric shape involved, but was unable to get it from direct integration. The integral gets unwieldy and the result has too many pieces to resemble $\frac15-\tan^{-1}\frac17$.