Find the condition between f(x) and varphi(x) so that (*)…
Find the condition between $f(x)$ and $\varphi(x)$ so that $(*)\!: \qquad y'' + f(x)y' + \varphi(x)y = 0$ has two solutions $y_1,y_2$ related by $y_2=y_1^2$.
Explanation of Method
Requiring $y_2=y_1^2$ to also solve the equation forces $(y_1')^2=(\varphi/2)y_1^2$ and a Bernoulli relation for $p=y_1'/y_1$, yielding a closed-form condition $f=f(\varphi)$.
Step 1: Imposing $y_2=y_1^2$
Set $z:=y_1^2$, required to also satisfy $(*)$. Differentiating twice, $z' = 2y_1y_1', \qquad z'' = 2(y_1')^2 + 2y_1y_1''$.
Substituting into $z''+fz'+\varphi z=0$, and using $y_1''=-fy_1'-\varphi y_1$ (since $y_1$ solves $(*)$) to eliminate $y_1''$: $2(y_1')^2 + 2y_1\bigl(-fy_1'-\varphi y_1\bigr) + f\bigl(2y_1y_1'\bigr) + \varphi y_1^2 = 0$.
Step 2: The $f$-terms cancel
Expanding, the terms $-2fy_1y_1'$ and $+2fy_1y_1'$ cancel identically, leaving
\[ 2(y_1')^2 - 2\varphi y_1^2 + \varphi y_1^2 = 0 \;\Longrightarrow\; 2(y_1')^2 = \varphi\,y_1^2, \]
i.e. $(y_1')^2 = \frac{\varphi}{2}\,y_1^2$.
So $y_1$ must satisfy this purely $\varphi$-determined relation; write $p:=y_1'/y_1=\pm\sqrt{\varphi/2}$.
Step 3: A Bernoulli equation for $p$
From $y_1'=py_1$, $y_1''=(p'+p^2)y_1$; substituting into $y_1''=-fy_1'-\varphi y_1=(-fp-\varphi)y_1$ gives
\[ p' + p^2 = -fp - \varphi. \]
Since $p^2=\varphi/2$, i.e. $\varphi=2p^2$, this becomes $p'+\tfrac{\varphi}{2}=-fp-\varphi$, so $p'=-fp-\tfrac32\varphi=-fp-3p^2$, i.e.
\[ p' + 3p^2 + f\,p = 0. \]
Step 4: Solving for $f$
From the Bernoulli relation, $f = -\frac{p'+3p^2}{p} = -\frac{p'}{p} - 3p$.
Differentiating $p^2=\varphi/2$ gives $2pp'=\varphi'/2$, so $p'/p=\varphi'/(4p^2)=\varphi'/(2\varphi)$. Taking the positive branch $p=\sqrt{\varphi/2}$: $f(x) = -\frac{\varphi'(x)}{2\varphi(x)} - 3\sqrt{\frac{\varphi(x)}{2}}$.
(the negative branch $p=-\sqrt{\varphi/2}$ gives the companion relation $f=-\varphi'/(2\varphi)+3\sqrt{\varphi/2}$).
Step 5: The general solution
With $p=\sqrt{\varphi/2}$, $y_1=\exp\!\left(\int p\,dx\right)$ and $y_2=y_1^2=\exp\!\left(2\int p\,dx\right)$. Their Wronskian is
\[ W = y_1y_2' - y_1'y_2 = y_1(2y_1y_1') - y_1'y_1^2 = 2y_1^2y_1' - y_1^2y_1' = y_1^2y_1', \]
which is nonzero whenever $y_1'\neq0$, i.e. whenever $\varphi\neq0$; so $y_1,y_2$ are linearly independent under exactly the stated condition, and
\[ y = C_1y_1 + C_2y_1^2 = C_1\,e^{\int p\,dx} + C_2\,e^{2\int p\,dx}. \]
Step 6: Verification
The derivation shows the chain of equivalences is reversible: starting from $f=-\varphi'/(2\varphi)-3\sqrt{\varphi/2}$, the function $p=\sqrt{\varphi/2}$ satisfies the Bernoulli equation $p'+3p^2+fp=0$ by construction (Step 4 run backward), hence $y_1=e^{\int p\,dx}$ satisfies $y_1''+fy_1'+\varphi y_1=0$ (Step 3 run backward), and then $(y_1')^2=(\varphi/2)y_1^2$ (the defining relation of Step 2) is exactly what makes $z=y_1^2$ satisfy the same equation (Step 1 run backward). So for any $\varphi$, choosing $f$ by the boxed formula guarantees $y_2=y_1^2$ is a genuine second solution alongside $y_1$.
Result
Final answer:
\[\boxed{\,f(x) = -\frac{\varphi'(x)}{2\varphi(x)} - 3\sqrt{\frac{\varphi(x)}{2}}\,}\]
Remark
Remark. This is the direct analogue of Problem 212: there, requiring $y_1y_2=1$ forced $\alpha=\beta'/(2\beta)$; here, requiring $y_2=y_1^2$ forces $f=-\varphi'/(2\varphi)-3\sqrt{\varphi/2}$. Both conditions arise from the same mechanism — substituting the proposed second solution back into the equation and eliminating the second derivative of $y_1$ via the equation itself.