We all know that the conservation of energy is written as
$$\Delta U + \Delta K = 0$$
But when we are dealing with systems in which the energy is not conserved (trivial example: the friction), we are in presence of a work done by this non conservative force, which leads us to write
$$\mathcal{L}_{nc} = \Delta E$$
Let's take a problem in which $K_f = U_i = 0$, we now have simply
$$\mathcal{L}_{nc} = U_f - K_i$$
Where "nc" stands for "non conservative".
Now I had to deal with a problem of this kind, in which I have a mass $M$ pushed by a spring which moves a bit straight (no friction here), and then there is an inclined plane with friction $\mu$.
The question is how much far, on to the inclined plane, the body travels.
Taking into account that the body has an initial velocity due to the spring release, $v_i$, and the final velocity must be zero, and the potential energies are $0$ for the initial one and $mgh = mg\ell\sin\theta$ for the final one (where $\theta$ is the angle of inclination, $\ell$ is the traveled distance), we write (according to the definition above)
$$\mathcal{L}_{nc} = \Delta E = U_f - K_i = mg\ell\sin\theta - \frac{1}{2}mv_i^2$$
Now
$$\mathcal{L}_{nc} = F\cdot \ell = mg\ell \mu\cos\theta$$
And due to this, $\ell$ can be calculated.
Now the professor instead wrote on the paper that the correct result is
$$\mathcal{L}_{nc} + mg\ell\sin\theta = \frac{1}{2}mv_i^2$$
I don't understand why the signs are messed up, and basically it's like if he says that
$$\mathcal{L}_{nc} = -\Delta E$$
Can someone please explain me the whole situation?
Thank you so much!
Details can be added, if you need any