Differentiating an Integral Equation We're trying to solve the following problem by converting to differential equations:
   $$\phi(x) = x - \int_0^x(x-s)\phi(s)\,ds$$
We can differentiate both sides and use the product rule and the FTC1 to get:
$$\phi'(x)=1-\int_0^x \phi(s) \mathrm{d}s -x \phi(x)+x\phi(x)$$
$$\phi'(x)=1-\int_0^x \phi(s) \mathrm{d} s$$
We can differentiate it again:
$$\phi''(x)=0 - \frac{d}{dx}\int_0^x\phi(s)\,ds \equiv 0$$
From this determination of $\phi''(x)$ I cannot make any progress. Can anyone see where I am going wrong?
 A: Starting with
$\phi(x) = x - \displaystyle \int_0^x (x - s)\phi(s) \; ds, \tag 1$
we transform it through equivalent forms, thus:
$\phi(x) = x - \displaystyle \int_0^x x \phi(s) \; ds + \int_0^x s\phi(s) \; ds; \tag 2$
$\phi(x) = x - x\displaystyle \int_0^x \phi(s) \; ds + \int_0^x s\phi(s) \; ds; \tag 3$
then
$\phi'(x) = 1 - \displaystyle \int_0^x \phi(s) \; ds - x\phi(x) + x\phi(x) = 1 - \int_0^x \phi(s) \; ds; \tag 4$
$\phi''(x) = -\phi(x), \tag 5$ 
or
$\phi''(x) + \phi(x) = 0; \tag 6$
the general solution to this linear, time-invarian, homogeneous, ordinary differential equation is known to be of the form
$\phi(x) = A\cos x + B \sin x; \tag 7$
we need some initial/boundary conditions to determine $A$ and $B$; from (3),
$\phi(0) = 0, \tag 8$
whilst from (4),
$\phi'(0) = 1; \tag 9$
also,
$\phi'(x) = -A\sin x + B \cos x; \tag{10}$
(7)-(10) give us
$A\cos 0 = 0 \Longrightarrow A = 0, \tag{11}$
$B\cos 0 = 1 \Longrightarrow B = 1; \tag{12}$
thus we find
$\phi(x)  = \sin x. \tag{13}$
CHECK: scrutiny of (3) leads us to compute:
$\displaystyle \int_0^x \sin s \; ds = -(\cos x - \cos 0) = -\cos x + 1; \tag{14}$ 
$\displaystyle x\int_0^x \sin s \; ds = -x\cos x + x; \tag{14}$ 
$x - \displaystyle x\int_0^x \sin s \; ds = x + x\cos x - x = x\cos x; \tag{15}$
it is easy to verify that
$\displaystyle \int_0^x s\sin s \; ds = -x\cos x + \sin x \tag{16}$
by direct differentiation; therefore,
$x - \displaystyle x\int_0^x \sin s \; ds + \int_0^x s\sin s \; ds = \sin x; \tag{17}$
if we substitute (13) into this equation we obtain (3), and hence (1), thus validating our solution.
As pointed out by amsmath in his comment on the question itself, our OP LightningStrike's error lies in the assertion that
$\dfrac{d}{dx}\displaystyle \int_0^x \phi(s) \; ds = 0; \tag{18}$
if the correct derivative
$\dfrac{d}{dx}\displaystyle \int_0^x \phi(s) \; ds = \phi(x) \tag{19}$
is used, (5)-(6) follow directly from (4) as we have affirmed.
