# Hydrostatic force from a fluid with varying density

How do I solve for the hydrostatic force acting on a vertical surface from a fluid with linearly varying density?

A. $dF = \rho g h\cdot dA$ and integrate to solve F

or

B. $dP = \rho g dh$ and integrate to solve for P and substitute P to... $dF = P\cdot dA$ and integrate for F

where $F =$ Force, $\rho =$ density, $g = 9.81 m/s^2$, $h =$ height, $A =$ area, $P =$ pressure.

I was expecting to arrive with the same answer from the two methods but apparently, upon solving, I was wrong. I am now more inclined to solution B, because my colleagues said that the equation in solution A is only applicable to constant density but I cannot confirm it from the textbooks that I have researched. Thanks in advance.

• If the density is a function of pressure and the pressure is varying with height, the density must be varying with height also. So, which value of the density do you use? – Chet Miller Sep 30 '16 at 14:58

At a height $h$ for an infinitesimal change in height $dh$ the change in pressure $dP$ is given by $dP= g \rho(h) dh$ where $\rho(h)$ is the density of the fluid at height $h$.
To find the change in pressure you now need to integrate and then using $PA$ where $P$ is the pressure acting on $A$ you can find the force.