In a static fluid the pressure field equation is given as:

$\nabla P = \rho \vec{g}$

In order to solve this we need to recognize the meaning of the $\nabla$ (gradient) operator.

The **gradient** is a measure of the rate of change of a
quantity in space (a slope). It yields a vector pointing in the
direction of maximum spatial rate of change, so that the gradient
of the temperature, for example, is (in cartesian coords):

$\displaystyle{\nabla T = \frac{\partial T}{\partial x}\vec{e_x} + \frac{\partial T}{\partial y}\vec{e_y} + \frac{\partial T}{\partial z}\vec{e_z}}$

Using this definition, and taking z to be in the vertical direction, the component form of the Pressure Field Equation is written as:

$\displaystyle{\frac{\partial P}{\partial x}\vec{e_x} + \frac{\partial P}{\partial y}\vec{e_y} + \frac{\partial P}{\partial z}\vec{e_z} = \rho g \vec{e_y}}$

Rearrange and simplifying gives that the pressure is constant in the x and y directions, but varies in the z direction as:

$\displaystyle{\frac{dP}{dz} = \rho g}$

$P_1-P_2 = \rho g (z_2-z_1) = \rho gh$

While this looks exactly like where we started with our balance of forces, it is actually different because it is true for the whole fluid continuum, not simply for the small control volume on which we were doing the balance (this will make more sense when you do the Test Yourself, below).

Calculate the pressure distribution in a fluid or system of fluids that is at rest

Calculate the pressure distribution in a static gas. What is different in this case. As an example approximate the pressure distribution in the Earth's atmosphere.

$\nabla P = \rho \vec{g}$

Taking this as a 1D problem in rectangular coordinates (close anyway) and putting the origin at the surface of the earth with positive z upward, we get:

$\displaystyle{\frac{dP}{dz} = -\rho g}$

Assuming that air is an ideal gas, we can plug in $PV = nRT$ where we solve for $\rho = n/V$ so that $\rho = P/RT$:

$\displaystyle{\frac{dP}{dz} = -\frac{P}{RT}g}$

Rearranging and assuming that $T$ does not change with z we get:

$\displaystyle{\frac{dP}{P} = -\frac{g}{RT}dz}$

which we can integrate from the surface of the earth (at $P = P_{atm}$) to some atmospheric height, $H$, where we will define $P = P$, to give:

$\displaystyle{\int_{P_{atm}}^{P} \frac{dP}{P} = -\frac{g}{RT}\int_0^H dz}$

$\displaystyle{P = P_{atm}e^{-\frac{gH}{RT}}}$