Update -- General solution comprising all solutions
If we take an even less familiar route and move a non-real, complex number, such as I
, to infinity, we can get the solution(s) for all valid initial (real) values for y'[x]
, which must be at least 1
.
ysol = First@ DSolve[{y'[x] + 2 E^x y[x] - y[x]^2 == E^(2 x) + E^x}, y[x], x] /.
C[1] -> 1/(C[1] - I) // Together;
Csol = Solve[D[y[x] /. ysol, x] == c /. x -> 0, C[1]];
gensol = {y -> Function @@ #} & /@ Thread[{x, y[x] /. ysol /. Csol // Simplify}]
{y[0], y'[0]} /. gensol // Simplify (* initial values *)
y[x] /. gensol /. c -> 1 (* OP's desired solution *)
(*
{{y -> Function[x, (-Sqrt[-1 + c] + E^x (1 + Sqrt[-1 + c] x))/(1 + Sqrt[-1 + c] x)]},
{y -> Function[x, (Sqrt[-1 + c] + E^x - Sqrt[-1 + c] E^x x)/(1 - Sqrt[-1 + c] x)]}}
{{1 - Sqrt[-1 + c], c}, {1 + Sqrt[-1 + c], c}} (* initial values *)
{E^x, E^x} (* OP's desired solution *)
*)
Generically, there are two distinct solutions for each initial value for y'[0]
, but they coincide for y'[0] == 1
.