Solution (source code)

= Solution

For compactly supported smooth variations $(\phi,\psi)$, differentiating at $t=0$ gives
$$
0=\frac12\frac d{dt}E[X+t\phi,Y+t\psi]\bigg|_{t=0}
=\int_\Omega\left[
\frac{\nabla X\cdot\nabla\phi+\nabla Y\cdot\nabla\psi}{X^2}
-\frac{(|\nabla X|^2+|\nabla Y|^2)\phi}{X^3}
\right].
$$
This is the <weak formulation>. Taking $\psi=0$ or $\phi=0$ separates its two equations. When $X,Y$ are smooth, <integration by parts> transfers each derivative from the test function; the <fundamental lemma of the calculus of variations> then recovers exactly the two pointwise equations in part (a).