Work in thermodynamics and work in mechanics work in mechanics
$w=\vec{f} \cdot \vec{s}$
work in thermodynamics
$w=-p \Delta v$
I don't understand why $ \vec{f} \cdot \vec{s}= -p \Delta v$ ?
 A: 
work in mechanics
$w=\vec{f} \cdot \vec{s}$


work in thermodynamics
$w=-p \Delta v$


I don't understand why $ \vec{f} \cdot \vec{s}= -p \Delta v$ ?

If the work is performed by compressing a volume with a fixed force $f$ (where the force $f$ is applied to a cross-sectional area $a$ and where the normal to the cross-sectional area is in the same direction as the force), then the work done on the volume is:
$$
-p\Delta v = -pAs
$$
And the work done by the volume is:
$$
p\Delta v = pAs
$$
The pressure is the force per unit area:
$$
p=f/A
$$
So the work done by the volume in this special case is:
$$
p\Delta v = \frac{f}{A}As = fs = \vec f \cdot \vec s
$$
A: The terms aren't generally equivalent, as they describe two different types of work. Work is any energy transfer to a (closed) system that doesn't involve heating, so a broad variety of flavors is possible.
Force–distance work involves a force $\vec f$ applied through a collinear distance $\vec s$.
Pressure–volume work involves a pressure (that is, a negative equitriaxial stress) $p$ applied through a decreasing volume $-\Delta v$. (These two negatives combine to give positive work.)
In addition, we can have stress–volumetric strain work, voltage–charge work, surface tension–area work, magnetic field–magnetization work, electric field–polarization work, and so on.
Make sense?
A: Imagine a bottle beeing filled with air through a hand pump. 
If you press the handle of the hand pump, you apply the force $\vec{f}$ down to the stop along the way $\vec{s}$.
Now assume that you slowly let your muscle lose, the work which will applied against your arm can than be described as  $-p \Delta V$. $^1$
$$(1) \quad \vec{f}*\vec{s} = -p \Delta V$$
$^1$ The pressure must remain constant if you want to apply this exact formula. In this example this would be possible if you supply heat to the bottle during the process. But then we wouldn´t have a closed system and the equal sign in (1) will be wrong. 
To avoid this problem and allow a variable pressure over the process you can use an integral $W = -\int{p(V) dV} = \int{\vec{f}_{(\vec{s})}} \cdot  d \vec{s}$
A: From first law of thermodynamics,
$dQ=dU+dW\tag1$
$dQ=dE=d(pV)=Vdp+pdV\tag2$
From (1) & (2),
$dW=pdV\tag3$
In mechanics, there is no heat energy and neglecting friction then (1) becomes,
$dU=-dW=-pdV\tag4$
In closed system or closed loop,
$\oint dU=0=\oint -dW\tag5$
If (5) is true then force can be expressed as gradient of potential or internal energy.
$\mathbf F=\dfrac{dU}{dx}\hat x\implies \int dU=\int \mathbf F\cdot d\mathbf x\tag6$
From (4) & (6),
$\mathbf F\cdot d\mathbf x=-pdV\tag*{}$
