An IVP with singularity having continuous solutions I am TAing undergraduate differential equation course, and recently have encountered  the following problem:
Solve the following initial value problem
$$ y' + (\tan x) \cdot y = \cos ^2 x, \quad y(0) = 1$$
and give the largest interval $I$ over which the solution is defined. (In this problem, solving the equation means finding all the continuous, differentiable functions that satisfy the given differential equation at each point of the domain.)
The DE gives the general solution $$y = \sin x \cdot \cos x + \cos x$$ for $x \in (-\frac{\pi}{2},\frac{\pi}{2})$.
The problem is that this solution can be extended to the whole real line $\mathbb{R}$ so that the extension, which turns out to be $y = \sin x \cdot \cos x + \cos x$ for $x \in \mathbb{R}$, is continuously differentiable in the whole real line.
Some people in the class suggest therefore the answer be $I=\mathbb{R}$.
However I think the answer is $I = (-\frac{\pi}{2},\frac{\pi}{2})$.
Here's my thought:
According to Picard's theorem (although the name could be wrong), a unique solution to an IVP exists on the interval where the given DE is 'regular'. Thus the solution exists uniquely on the interval $(-\frac{\pi}{2},\frac{\pi}{2})$ over which the initial value is given and the DE is regular. One can find so called 'one-parameter family of solutions' $y = \sin x \cdot \cos x + c\cdot \cos x$ on intervals other than $(-\frac{\pi}{2},\frac{\pi}{2})$, but cannot determine the constant $c$ because we don't have any clues on the behavior of the solutions on those intervals. Therefore one cannot say the solution to the IVP exists uniquely on those intervals, and also cannot say the solution is well-defined on those intervals.
Can anyone tell me which part of my thought is wrong, if there is any? I'd be glad to any explanations. Thank you.
 A: I would say you're right on track. In fact, the family of solutions may be broader than that! Consider any functions $f,g:\Bbb Z\to\Bbb R,$ and define $$h(f,g,x):=\begin{cases}\bigl(f(n)+\sin x\bigr)\cos x & n\in\Bbb Z,x\in\left(n\pi-\frac\pi2,n\pi+\frac\pi2\right)\\g(n) & n\in\Bbb Z,x=n\pi+\frac\pi2.\end{cases}$$
Here are a few facts about the function $F(x)=h(f,g,x)$ that I leave to you to verify:


*

*$F:\Bbb R\to\Bbb R,$ regardless of our choices of $f$ and $g.$

*$F$ is continuous on $\Bbb R$ if and only if $g$ is identically zero.

*$F$ is differentiable on $\Bbb R$ if and only if $f$ is constant and $g$ is identically zero--that is, if and only if $h(f,g,x)=(c+\sin x)\cos x$ for some constant $c.$

*$y=F(x)$ is a solution to the IVP if and only if $f(0)=1.$
Thus, uniqueness fails (rather badly) outside the interval $\left(-\frac\pi2, \frac\pi2\right),$ but we certainly have existence. The only solution that is everywhere differentiable on the whole real line is $y=(1+\sin x)\cos x.$ Every solution is identical to this on the interval $\left(-\frac\pi2,\frac\pi2\right),$ but (unless we impose more restrictions on our solutions) need not agree with it anywhere else.
