First of all, DSolve
does not really take assumptions. (What I mean, DSolve seems to ignore assumptions)
Euler ODE can have 3 different solutions depending on roots $r_1,r_2$ of the characteristic equation. For one repeated root, solution is $y=c_1 x^r+ c_2 x^r \ln x$, and for 2 real and distinct roots, solution is $y=c_1 x^{r_1}+ c_2 x^{r_2}$ and for two complex conjugate roots, solution is $y=c_1 x^{\alpha+i\beta} + c_2 x^{\alpha-i\beta}$
For your case, the roots are $r_1 = -\sqrt{n},r_2 = \sqrt{n}$. Hence for $n>0$ then we are in the second case (2 real distinct roots).
The characteristic equation for Euler ode is found by substituting $y=A x^r$ into the ode and then solving for $r$
You can obtain, for n>0
the solution you want this way
Clear["Global`*"];
ode = x^2 y''[x] + x y'[x] - n y[x] == 0
sol = DSolve[ode, y[x], x]
sol = TrigToExp[sol]
sol = Collect[sol, { x^-Sqrt[n], x^Sqrt[n]}]
We are free to rename constants as we want. Hence
sol = sol /. {C[1]/2 - (I C[2])/2 -> C[3], C[1]/2 + (I C[2])/2 -> C[4]}
Verify
ode /. y -> Function[{x}, x^-Sqrt[n] C[3] + x^Sqrt[n] C[4]] // Simplify
(* True *)
Update
what is the characteristic equation?
Clear["Global`*"];
ode = x^2 y''[x] + x y'[x] - n y[x] == 0;
charEquation = ode /. y -> Function[{x}, A*x^r]
Since $A$ and $x^r$ are non zero, we can divide by them and the above simplifies to
Solve[- n + r + (-1 + r) r == 0, r]
which gives the solutions
And since $n>0$ then we have two real distinct roots.
\[DoubleStruckCapitalR]
is colored with blue, which means that this has no built-in meaning and doesn't represent the set of real numbers. You should useReals
or type withEsc``reals``Esc
. $\endgroup$y[1] == y1
andy'[1] == yP1
. $\endgroup$