How to prove the existence and uniqueness of the solution of a second order linear ODE? Considering homogeneous, linear, second order differential equation
$$y'' + p(x)y' + q(x)y = r(x), a<x<b$$
$p, q, r$ are given. We already know $y(a) = A, y(b) = B$ and $q(x) < o$. How to prove that this equation has unique solution in $[a,b]$ if it has a solution?
 A: Suppose $y_1(x)$ and $y_2(x)$ both satisfy
$y'' + p(x) y' + q(x)y = r(x) \tag 1$
with
$y_1(a) = y_2(a) = A, \; y_1(b) = y_2(b) = B; \tag 2$
then we have
$y_1'' + p(x) y_1' + q(x)y_1 = r(x) \tag 3$
and
$y_2'' + p(x) y_2' + q(x)y_2 = r(x), \tag 4$
and, subtracting,
$(y_1 - y_2)'' + p(x) (y_1 - y_2)' + q(x)(y_1 - y_2) = 0, \tag 5$
and
$(y_1 - y_2)(a) = y_1(a) - y_2(a) = 0 = y_1(b) - y_2(b) = (y_1 - y_2)(b); \tag 6$
setting
$z(x) = y_1(x) - y_2(x), \tag 7$
we have
$z'' + p(x) z' + q(x) z = 0, \; z(a) = z(b) = 0; \tag 8$
now if $z'(a) = 0$, then by uniqueness of solutions we must have $z(x) = 0$, $x \in [a, b]$, since $z(a) = 0$, and thus $y_1(x) = y_2(x)$, and we are done; so we assume $z'(a) \ne 0$; in fact, since (8) is linear, we may take $z'(a) > 0$, and thus, by the continuity of $z'(x)$, there is some $\delta > 0$ such that
$z'(x) >  0, \; x \in [a, a + \delta); \tag 9$
we then have
$z(x) = z(x) - z(a) = \displaystyle \int_0^x z'(s) \; ds > 0, x \in (a, a + \delta); \tag{10}$
since $z(x) > 0$ somewhere on $[a, b]$, it must have a positive absolute maximum $x_M \in (a, b)$; at such a point
$z'(x_M) = 0, \tag{11}$
and thus by (8),
$z''(x_M) = -q(x_M)z(x_M) > 0 \tag{12}$
by virtue of the facts that $z(x_M) > 0$, $q(x_M) < 0$; but (12) is impossible at a maximum of $z(x)$, where we must have $z''(x_M) \le 0$; this contradiction forces $z'(a) = 0$ and thus also
$z(x) = 0, \; x \in [a, b], \tag{13}$
and hence
$y_1(x) - y_2(x) = z(x) = 0, \; x \in [a, b]; \tag{14}$
we conclude the equation (1) with boundary conditions (2) has at most one solution on $[a, b]$.
