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
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.