Finding a $C^1$ solution to a differential equation. I need to find a $C^1$ solution to the differential equation $2xy'(x)+y(x)=\frac{1}{1-x}$ on $]-\infty,1[$. (It is supposed to exist and be unique)
To do this, I was instructed to find solutions over $]-\infty,0[$ and over $]0,1[$
What I found, respectively, was: (details at the end)
$y_1(x)=-\frac{1}{\sqrt{-x}}\arctan{\sqrt{-x}}+\frac{c_1}{\sqrt{-x}}$ and $y_2(x)=\frac{1}{2\sqrt{x}}\log(\frac{1+\sqrt{x}}{1-\sqrt{x}})+\frac{c_2}{\sqrt{x}}$
From this (assuming I didn't make any mistakes), I am supposed to use series expansion to find a $C^1$ solution over $]-\infty,1[$
The solutions I found are $C^1$ on their respective interval. My guess is that one should check what happens at $0$ for both the solutions I found, and see if there is a possibility of "joining" them at $0$ into a continuous function on $]-\infty,1[$.
First, if my solution is to be continuous, $c_1=c_2=0$, because my series expansions at $0$ show that both $-\frac{1}{\sqrt{-x}}\arctan{\sqrt{-x}}$ and $\frac{1}{2\sqrt{x}}\log(\frac{1+\sqrt{x}}{1-\sqrt{x}})$ are finite at $0$.
Indeed, 
$-\frac{1}{\sqrt{-x}}\arctan{\sqrt{-x}}=-1-\frac13x+o((-x)^{3/2})$
$\frac{1}{2\sqrt{x}}\log(\frac{1+\sqrt{x}}{1-\sqrt{x}})=1+\frac13x+o(x^{3/2})$
so if the constants $c_1,c_2$ are non-zero, the solution will blow up at $0$.
but now I have a problem: these solutions don't join into a smooth, continous function at $0$ since left and right limits are different ($-1$ and $1$), and I have no constant to play on to make them equal.
Any idea? I'm not sure whether I have a fundamental misunderstanding of differential equations or I have made a mistake somewhere in my calculations.

Details on calculations:
$2xy'(x)+y(x)=0 \Leftrightarrow (y=0 \text{ or} \log|y|=-\frac12\log|x|+\text{cst}) \Leftrightarrow y(x)=\frac{\text{cst}}{\sqrt{|x|}}$ for the homogeneous solution
Then I use the variation of constants to find a solution to the complete equation.
Over $]-\infty,0[:$
Let $f(x)=\frac{1}{\sqrt{-x}}$ and $h(x)$ some $C^1$ function.
$2x(f'(x)h(x)+h'(x)f(x))+f(x)h(x)=\frac{1}{1-x}=2xh'(x)f(x)+\color{red}{h(x)[f(x)+2xf'(x)]}$
The red part vanishes as $f$ is a solution to the homogeneous equation.
So $h'(x)=\frac{1}{2xf(x)(1-x)}=\frac{1}{2\sqrt{-x}(1-x)}$
and $\int\frac{1}{2\sqrt{-x}(1-x)}dx=\int\frac{1}{2u(1+u^2)}(-2u du)=-\arctan{\sqrt{-x}}+\text{cst}$
using $u=\sqrt{-x}$, $du=-\frac{1}{2u}dx$
So, over $]-\infty,0[$, the solutions are $(-\arctan{\sqrt{-x}}+\text{cst})f(x)=-\frac{1}{\sqrt{-x}}\arctan{\sqrt{-x}}+\frac{c_1}{\sqrt{-x}}$
Over $]0,1[$, I use the same method with $f(x)=\frac{1}{\sqrt{x}}$:
$h'(x)=\frac{1}{2xf(x)(1-x)}=\frac{1}{2\sqrt{x}(1-x)}$
and $\int\frac{1}{2\sqrt{x}(1-x)}dx=\int\frac{1}{2u(1-u^2)}(2u du)=\text{arctanh}{\sqrt{x}}+\text{cst}=\frac12 \log{\frac{1+\sqrt{x}}{1-\sqrt{x}}+\text{cst}}$
So, over $]0,1[$, the solutions are $\frac{1}{2\sqrt{x}} \log{\frac{1+\sqrt{x}}{1-\sqrt{x}}}+\frac{c_2}{\sqrt{x}}$
I really don't see what's wrong... Any hint is welcome.
 A: You are almost correct. The only $C^1$-solution should be
$$y(x)=
\begin{cases}
\dfrac{\arctan{\sqrt{-x}}}{\sqrt{-x}}&\text{for $x<0$}\\
1&\text{for $x=0$}\\
\dfrac{\text{arctanh}{\sqrt{x}}}{\sqrt{x}}&\text{for $0<x<1$}.
\end{cases}$$
which is $C^1$ at $0$ with expansion $y(x)=1+\frac{x}{3}+o(x)$. You can easily check that the differential equation
$$2xy'(x)+y(x)=\frac{1}{1-x}$$ holds for all $x<1$.
In particular, for $x<0$, $2xy'(x)+y(x)$ is equal to
$$
2x\left( -\frac{(-x)^{-1/2}}{2(1+(-x))}\cdot(-x)^{-1/2}
+\arctan{(-x)^{1/2}\cdot\frac{(-x)^{-3/2}}{2}}
\right)+(-x)^{-1/2}\arctan(-x)^{1/2}
$$
which simplifies to $\frac{1}{1-x}$.
A: It might seem that the existence of such a solution is a coincidence and that by pure luck we are able to concatenate the two partial solutions for $x<0$ and $x>0$. Note that the assumptions of the standard existence theorem for ODEs are not satisfied when $x=0$. 
In reality  this solution is even real analytic over the whole interval ${\mathbb R}_{<1}$. To see this use
$$\arctan y= \int_0^y {dt\over 1+t^2}=y\int_0^1 {d\tau\over 1+ y^2\tau^2}\ ,$$ and similarly for the ${\rm artanh}$. We then can rewrite the two obtained expressions under the following common umbrella:
$$f(x)=\int_0^1{dt\over 1- x\,t^2}\>dt\qquad(-\infty<x<1)\ .$$
The above claim is then obvious. This $f$ indeed satisfies the given differential equation, since differentiation under the integral sign and partial integration gives
$$2xf'(x)=\int_0^1 t\,{2xt\over(1-x\, t^2)^2}\>dt=t{1\over 1-x\,t^2}\Biggr|_{t=0}^{t=1}-\int_0^1{dt\over 1-x\, t^2}={1\over 1-x}- f(x)\ .$$
