# Solve and plot differential equation

I want to solve this differential equation

$\qquad y'(x)=\frac{x-y(x)}{1-y(x)-x}$

and plot it's solution. But DSolve doesn's work.

DSolve[{y'[x] == (x - y[x])/(1 - x - y[x])}, y[x], x]

Solve[
2 ArcTan[(-x + y[x])/(-1 + x + y[x])] + C + 2 Log[-1 + 2 x] +
Log[(1 - 2 x + 2 x^2 - 2 y[x] + 2 y[x]^2)/(-1 + 2 x)^2] == 0,
y[x]]


How can I plot such an expression?

I tried this:

ContourPlot[
2*ArcTan[(-x + y)/(-1 + x + y)] + 2*Log[-1 + 2*x] +
Log[(1 - 2*x + 2*x^2 - 2*y + 2*y^2)/(-1 + 2*x)^2] == 0,
{x, -0, 3}, {y, -2, 2}] There is another problem. I don't have an initial condition of the form $y(x_{0})=c_0$, but I know that $x(0)=0$ and $y(0)=0$.

This differential equation comes from the physics and I know that $\frac{dy}{dx}$ is a velocity, and I can split this equation into two parts and introduce the parametric velocities $\frac{dy}{dt}$ and $\frac{dx}{dt}$. Then

DSolve[{y'[t] == x[t] - y[t], x'[t] == 1 - x[t] - y[t], x == 0, y == 0},{x[t], y[t]}, t]

{{x[t] -> 1/2 E^-t (-Cos[t] + E^t Cos[t]^2 + Sin[t] + E^t Sin[t]^2),
y[t] -> 1/2 E^-t (-Cos[t] + E^t Cos[t]^2 - Sin[t] + E^t Sin[t]^2)}}


With this I can plot the solution.

ParametricPlot[
{1/2 E^-t (-Cos[t] + E^t Cos[t]^2 + Sin[t] + E^t Sin[t]^2),
1/2 E^-t (-Cos[t] + E^t Cos[t]^2 - Sin[t] + E^t Sin[t]^2)},
{t, 0, Pi}] Why doesn't Mathematica automatically do this transformation for me?

Why doesn't Mathematica automatically do this transformation for me?

Mathematica don't know that x is a function of t. But you can solve your system directly:

sol = NDSolveValue[{y'[x] == (x - y[x])/(1 - y[x] - x), y == 0}, y, {x, 0, 1}]


You get an error message:

NDSolveValue::ndsz: At x == 0.603939625832659, step size is effectively zero; singularity or stiff system suspected. >>

{x1, x2} = sol["Domain"] // First
Plot[sol[x], {x, x1, x2}, AxesLabel -> {x, y[x]}]
` 