Two identical containers X and Y are connected at the bottom by a thin

Two identical containers X and Y are connected at the bottom by a thin tube of negligible volume. The tube has a valve in it, as shown in the figure. Initially container X has a liquid filled up to height h in it and container Y is empty. When the valve is opened, both containers have equal amount of liquid in equilibrium. If the initial (before the valve is opened) potential energy of the liquid is Pᵢ and the final potential energy is Pғ, then:

Pᵢ=Pғ
Pғ = 1/4 * Pᵢ
Pᵢ=2Pғ
Pғ = 1/8 * Pᵢ
This question was previously asked in
UPSC NDA-1 – 2023
The correct option is C.
Potential energy of a continuous mass distribution like liquid is the integral of $y \cdot dm \cdot g$. For a liquid column of uniform density in a cylindrical container, the center of mass is at half the height. The potential energy is proportional to the mass and the height of the center of mass. When the liquid redistributes to reach equilibrium in connected identical containers, the total volume is conserved, and the liquid levels become equal.
Let A be the cross-sectional area of the identical containers. Initially, all liquid is in X up to height h. Volume $V = Ah$. Mass $m = \rho V = \rho Ah$. The initial potential energy is $P_i = mg(h/2) = (\rho Ah)g(h/2) = \frac{1}{2}\rho Ag h^2$. When the valve is opened, the liquid distributes equally by volume between X and Y, and the levels are equal. Let the final height in both be $h_f$. Total volume $Ah = A h_f + A h_f = 2Ah_f$, so $h_f = h/2$. The liquid in X has mass $m_X = \rho A (h/2)$, and its CM is at $(h/2)/2 = h/4$. PE in X is $P_{fX} = m_X g (h/4) = (\rho Ah/2)g(h/4) = \frac{1}{8}\rho Ag h^2$. Similarly, PE in Y is $P_{fY} = \frac{1}{8}\rho Ag h^2$. The total final potential energy is $P_f = P_{fX} + P_{fY} = \frac{1}{8}\rho Ag h^2 + \frac{1}{8}\rho Ag h^2 = \frac{1}{4}\rho Ag h^2$. Comparing $P_i$ and $P_f$: $P_i = \frac{1}{2}\rho Ag h^2$ and $P_f = \frac{1}{4}\rho Ag h^2$. Thus, $P_i = 2P_f$.