# How to obtain the solution of an ODE in implicit form?

I want to get the general solution of a first-order ODE in implicit form. It should be something like this:

1. With input y'[x] == 1, the desired output is C->y[x] - x.
2. With input y'[x] == 1/y[x]^2 (nonlinear ODE), the desired output is C->y[x]^3/3 - x

DSolve tries to evaluate the explicit form of y[x] by default. Is it possible to keep the implicit solution?

I tried explicit equation integration using Integrate and tracing (Trace with TraceInternal -> True). Neither helped me with this problem.

• Strongly related, if not duplicate: mathematica.stackexchange.com/q/137598/1871 Oct 14 '18 at 12:48
• But this seems not to work correctly. Quiet@Trace[DSolve[y'[x] == 1, y[x], x], Solve[e_, y[x]] -> (eqn = e), TraceInternal -> True]; eqn returns -1 + y[x] == 0 with no integration constant
– Ilya
Oct 14 '18 at 12:54
• Yes, and that's the reason I didn't vote for close as duplicate. Oct 14 '18 at 13:04

The following works for the two examples in the OP:

eq = y'[x] == 1; (* try also eq = y'[x] == 1/y[x]^2 *)
Solve[Equal @@ DSolve[eq, y[x], x][[1, 1]], C]
(* C -> -x + y[x] *)


Higher order ODEs contain more constants of integration, so OP shall modify the code accordingly.

• Thanks a lot! This works perfectly for both cases
– Ilya
Oct 14 '18 at 15:18
• @Ilya I'm glad I could help. If you try this with more examples, and one doesn't work, let me know and I'll see if I can do something. Cheers! Oct 14 '18 at 15:51