Solution (source code)

= Solution

After multiplying either solution by $-1$ if necessary, suppose both are positive on $(x_1,x_2)$. Set
$$
W=\varphi_1'\varphi_2-\varphi_1\varphi_2'.
$$
The equations give
$$
W'=(q_2-q_1)\varphi_1\varphi_2\geq0.
$$
Since $\varphi_1$ is positive between consecutive zeros,
$$
\varphi_1'(x_1)>0,\qquad \varphi_1'(x_2)<0.
$$
Therefore
$$
W(x_1)=\varphi_1'(x_1)\varphi_2(x_1)\geq0,
\qquad
W(x_2)=\varphi_1'(x_2)\varphi_2(x_2)\leq0.
$$
But $W$ is nondecreasing, so both endpoint values coincide at zero and $W'\equiv0$. Since both solutions are strictly positive inside,
$$
\boxed{q_1(x)=q_2(x)\quad(x_1<x<x_2)}.
$$
This is the equality case in the <wronskian proof of Sturm comparison>.