(N/A) Bernoulli's principle is based on the law of conservation of energy for a flowing fluid.
Consider a fluid flowing through a pipe of varying cross-section and height.
Let $P_1, A_1, v_1, h_1$ be the pressure,area,velocity,and height at the inlet,and $P_2, A_2, v_2, h_2$ be the corresponding values at the outlet.
According to the equation of continuity,the volume of fluid entering at one end in time $\Delta t$ is equal to the volume leaving at the other end: $\Delta V = A_1 v_1 \Delta t = A_2 v_2 \Delta t$.
Work done by pressure at the inlet: $W_1 = F_1 \Delta x_1 = P_1 A_1 (v_1 \Delta t) = P_1 \Delta V$.
Work done by pressure at the outlet: $W_2 = -F_2 \Delta x_2 = -P_2 A_2 (v_2 \Delta t) = -P_2 \Delta V$ (negative because it opposes flow).
Net work done by pressure: $W = (P_1 - P_2) \Delta V$.
Change in kinetic energy: $\Delta K = \frac{1}{2} m (v_2^2 - v_1^2) = \frac{1}{2} (\rho \Delta V) (v_2^2 - v_1^2)$.
Change in potential energy: $\Delta U = mg(h_2 - h_1) = (\rho \Delta V) g (h_2 - h_1)$.
By the work-energy theorem,$W = \Delta K + \Delta U$.
$(P_1 - P_2) \Delta V = \frac{1}{2} \rho \Delta V (v_2^2 - v_1^2) + \rho \Delta V g (h_2 - h_1)$.
Dividing by $\Delta V$ and rearranging terms:
$P_1 + \frac{1}{2} \rho v_1^2 + \rho g h_1 = P_2 + \frac{1}{2} \rho v_2^2 + \rho g h_2$.
Thus,$P + \frac{1}{2} \rho v^2 + \rho g h = \text{constant}$.