Showing $\Phi(x)=\int_0^x (x-t)f(t)\,dt$ is twice differentiable and finding $\Phi''(x)$
Let $f:\mathbb R\to \mathbb R$ be a continuous function and $\Phi(x)=\int_0^x (x-t)f(t)\,dt$. Justify that $\Phi(x)$ is twice differentiable and calculate $\Phi''(x)$.
I'm having a hard time finding the first derivative of $\Phi(x)$. Here's what I tried so far:
Since $f$ is a continuous function and $x-t$ is a polynomial function, thus continuous, $f(t)(x-t)$ is the product of two continuous functions and is also continuous. Since $x$ and $0$ are differentiable functions, by the Fundamental Theorem of Calculus
$\Phi'(x)= (x-x)f(x)x' - (x-0)f(0)0'=0$
I checked the solution and this is wrong, the solution goes like this: $\Phi'(x) = (x\int_0^xf(t)dt - \int_0^xtf(t)dt)' = \int_0^xf(t)dt + xf(x) - xf(x) = \int_0^xf(t)dt$
So I tried to do it their way, expanding $(x-t)f(t) to xf(t) - tf(t)$ and I got this:
$\Phi'(x) = (\int_0^x (x-t)f(t)dt)' = (\int_0^x xf(t) - tf(t)dt)' = (x\int_0^xf(t)dt - \int_0^xtf(t)dt)' = xf(x)x' - xf(0)0' - (xf(x)x' - 0f(0)0') = xf(x) - xf(x) = 0$
$0$ again.
Another thing I didn't understand is why they put the $x$ outside the integral, I thought we were only supposed to do that with constants. As in, why is $\int_0^x xf(t)dt = x\int_0^x f(t)\,dt$
I understand the rest of the exercise, I just can't get this derivative right with the Fundamental Theorem of Calculus. The version I'm using says
Let $f$ be a continuous function and $a(x)$ and $b(x)$ be differentiable functions. If $$F(x) = \int_{a(x)}^{b(x)} f(t) \,dt$$ then $F'(x) = f(b(x))b'(x) - f(a(x))a'(x)$
Is this correct? Because if so I don't understand how the derivative of this exercise works.
We can write
$$\Phi(x)=x\int_0^xf(t)\,dt- \int_0^xtf(t)\,dt$$
Using the product rule and the FTC, we get
$$\Phi'(x)=\int_0^xf(t)\,dt + xf(x) - xf(x) = \int_0^xf(t)\,dt$$.
Using FTC again, we have $$\Phi''(x) = f(x),$$ and we're done.