I have the equations:
$$f(x)=g(x)+\int_0^x p(x,s)q(s)ds\qquad (1)$$
$$g(x)=p(x,0)\cdot k\qquad (2)$$ ($k$ constant)
$$p(x,s)=e^{-\int_s^x a(t)+b(t) dt}\qquad (3)$$
Diferentiation of $1$ leads me to
$$f'(x)=k\cdot p'(x,0)+p(x,x)q(x)\qquad (4)$$ $$f'(x)=k\cdot p'(x,0)+q(x)\qquad (5)$$ $$f'(x)=-k(a(x)+b(x))p(x,0)+q(x)\qquad (6)$$ $$f'(x)=q(x)-(a(x)+b(x))g(x)\qquad (7)$$
However, the professor result is
$$f'(x)=q(x)-(a(x)+b(x))g(x)\fbox{$-(a(x)+b(x))\int_0^xp(x,s)q(s)ds$}\qquad (8)$$ $$f'(x)=q(x)-(a(x)+b(x))\fbox{$f(x)$}\qquad (9)$$
I'd like so much to understand my error. Thanks in advance!
I spot in your mistake in equation (4). You didn't use Leibniz rule correctly. It says that $$ \frac{d}{dx} \int_{a(x)}^{b(x)} f(t,x)\,dt=f(b(x),x)b'(x)-f(a(x),x)a'(x)+\int_{a(x)}^{b(x)}\frac{\partial f}{\partial x}(t,x)\,dt. $$ It seems to me like you applied the fundamental theorem of calculus, as in the situation, $$ \frac{d}{dx}\int_a^x f(t)\,dt=f(x), $$ but notice that in this problem, the integrand also depends on $x$.