How to calculate work done by variable kinetic friction force? A heavy chain with a mass per unit length $\rho$ is pulled by the constant force $F$ along a horizontal surface consisting of a smooth section and a rough section. The chain is initially at rest on the rough surface with $x=0$. If the coefficient of kinetic friction between the chain and rough surface is $\mu$, determine the velocity of the chain when $x=L$.
I am applying work energy theorem. Work done by constant Force will be Force × displacement of centre of mass i.e $FL$ but not able to find work done by friction. The friction force at an instant when chain length $x$ lies on the rough surface should be $\mu\rho x g$. This force is continuously decreasing. I feel calculus is involved here but I am unable to apply it. Please help me.
 A: The chain is initially at rest, so
\begin{equation}
KE_{o} = 0
\end{equation}
The force of friction is given by
\begin{equation}
f(x) = \mu \rho (L-x) g
\end{equation}
The net force on the chain is
\begin{equation}
\sum F = F - \mu \rho (L-x) g
\end{equation}
Work done on the chain is the integral of force over distance, so
\begin{equation}
W = \int_{0}^{L}F - \mu \rho (L-x) gdx
\end{equation}
Integrate and get
\begin{equation}
W = FL - \frac{1}{2} \mu \rho g L^{2}
\end{equation}
Use Work-Energy Theorem
\begin{equation}
KE_{f} = KE_{o} + W
\end{equation}
and final kinetic energy is
\begin{equation}
KE_{f} = FL - \frac{1}{2} \mu \rho g L^{2}
\end{equation}
Kinetic Energy equation
\begin{equation}
KE_{f} = \frac{1}{2} m v_{f}^{2} = \frac{1}{2} (\rho L) v_{f}^{2} = FL - \frac{1}{2} \mu \rho g L^{2}
\end{equation}
Solve for final velocity
\begin{equation}
v_{f} = \sqrt{\frac{2F}{\rho} - \mu gL}
\end{equation}
A: Great question!!

We will use the work-energy theorem for solving this.
$KE_i$ = 0 
Let the final velocity be v.
Therefore, $KE_f$ = $\frac{1}{2} m v_{f}^{2}$
$KE_f - KE_i = W_F + W_{fric}$
As you said, $W_F = FL$
Force of friction:
\begin{equation}
f(x) = \mu \rho (L-x) g
\end{equation}
\begin{equation}W_{fric} = -\int_{0}^{L}\mu \rho (L-x) gdx = -\mu \rho g \frac{L^2}{2} \end{equation} (The work is negative because friction and displacement are in opposite direction)
\begin{equation}KE_f - KE_i = FL -\mu \rho g \frac{L^2}{2}\end{equation}
$\frac{\rho Lv^2}{2}$ = $FL -\mu \rho g \frac{L^2}{2} $
Solving for v,
\begin{equation}
v_{f} = \sqrt{\frac{2F}{\rho} - \mu gL}
\end{equation}
This could have even been done with Forces but using Work-Energy theorem makes it much more easier. 
Note: This is just my second answer on this platform and I would love to get your responses and suggestions. Thank you!!
