# Differential equation question

asdf1
For this problem, "Please solve (2x-y+1)dx+(x+y)dy=0 "
My guess is that you have to make a linear transformation first to simplify the equation. However, I don't know how to make a linear transformation.

Homework Helper
rearrange to

$$2x-y+1 + (x+y)dy = 0$$ and test for exactness

asdf1
why did you take off the dx?

Homework Helper
asdf1 said:
For this problem, "Please solve (2x-y+1)dx+(x+y)dy=0 "
My guess is that you have to make a linear transformation first to simplify the equation. However, I don't know how to make a linear transformation.

First find out where the two lines:

y=2x+1
y=-x

intersect, say (h,k)

Then make the transformation:

x=u+h
y=v+k

Then substitute back into the ODE and solve in terms of u and v which should be homogeneous now.

asdf1
Why do you have to find the intersection?

Homework Helper
asdf1 said:
Why do you have to find the intersection?

Our objective is to remove the constant terms in both differential expressions so that we can obtain a homogeneous equation of order one. The simplest way to do that is to "translate the axes". Like if you had a linear equation: y(x)=4x+1 and you wanted to remove the 1. You could do that by translating the axes to the point (-1/4,0). That is, let v=y and u=x+1/4.

Substituting, we get: v=4(u-1/4)+1 or v=4u.

Same dif with the ODE above: If we have the expression:

$$(a_1x+b_1y+c_1)dx+(a_2x+b_2y+c_2)dy=0$$

and we consider the lines:

$$a_1x+b_1y+c_1=0$$

$$a_2x+b_2y+c_2=0$$

And find their intersection (h,k), then the translation:

$$x=u+h$$

$$y=v+k$$

will remove the constant terms and result in equations of the form:

$$a_1u+b_1v=0$$

$$a_2u+b_2v=0$$

How about a plot? Just use any old initial conditions that work.

asdf1
thank you very much! :)

Homework Helper
You know, this isn't an easy equation to analyze.

In terms of u and v I get so far:

$$\sqrt{2}ln\left[\sqrt{2u^2+v^2}\right]=-ArcTan\left(\frac{v}{u\sqrt{2}}\right)+k$$

Now I don't know how other people are, but that's just not good enough for me. Subsittuting x and y only make's it worst. I mean, what do you do with it in order to extract meaningful data from it? Well, turns out there's lots you can do with it.

The ODE is an example of the quintessential model of non-linear dynamics:

$$\frac{dy}{dx}=\frac{Ax+By}{Cx+Dy}$$

Solutions, depending on the coefficients, fall into several classes which exhibit typical non-linear behavior.

A thorough analysis of that behavior along with the behavior of this one:

$$\frac{dy}{dx}=c+ky-y^3$$

allows one, I think, to begin to obtain a unique perspective into the workings of nature since our world is massively non-linear.

Edit: Went over it again. Needed a negative sign in front of ArcTan.

Last edited:
Staff Emeritus
Gold Member
saltydog skipped a step in the explanation. He jumped past "make a linear transformation" straight to figuring out what kind of linear transformation he wants to make.

A linear transformation is a transformation that looks like:

$$(p, q) \rightarrow (a_1 p + b_1 q, a_2 p + b_2 q)$$

What you probably really wanted to do is to make an affine transformation (and what saltydog did was an affine transformation, not a linear one):

$$(p, q) \rightarrow (a_1 p + b_1 q + c_1, a_2 p + b_2 q + c_2)$$

So what you want to do is to define new variables, (u, v), by call the pre-transformed coordinates (x, y) and the post-transformed coordinates (u, v).

In other words, define

$$(u, v) := (a_1 x + b_1 y + c_1, a_2 x + b_2 y + c_2)$$

Then, once you've made the substitution, you can try and figure out what values for the coefficients would yield an equation you know how to solve.

Personally, I'd've done a different transformation: I would have aimed to eliminate the v dv term so that I could turn it into an ordinary first order differential equation. (with complex coefficients)

Last edited:
Homework Helper
Hurkyl said:
Personally, I'd've done a different transformation: I would have aimed to eliminate the v dv term so that I could turn it into an ordinary first order differential equation. (with complex coefficients)

Do you mean from this equation:

$$(2u-v)du+(u+v)dv=0$$

Staff Emeritus
Gold Member
Starting with

(2x - y + 1) dx + (x + y) dy = 0

I make the change of variable:

x = a1 u + b1 v
y = a2 u + b2 v

giving me:

(e1 u + e2 v + e3) du + (f1 u + f2 v + f3) dv = 0

In particular, I compute:

$$f_2 = 2 b_1^2 + b_2^2$$

So, if I set b1 and b2 so that f2 = 0, then I've eliminated the v dv term.

It seemed the simplest substitution would be:

x = iv
y = u + √2 v

Which yields, after rearrangement (if I've made no errors):

$$\frac{dv}{du} + \frac{\sqrt{2} + i}{i + (\sqrt{2} - i) u} v = \frac{-u}{i + (\sqrt{2} - i) u}$$

Which one can solve with standard methods. The trick is getting a real answer for x and y at the end, but I expect to be able to do so, even if it involves trying put logarithms together to form inverse trig functions.

P.S. I make no claim my approach is better, just that I expect I can do it.

Last edited:
Homework Helper
Hurkyl said:
Starting with

(2x - y + 1) dx + (x + y) dy = 0

I make the change of variable:

x = a1 u + b1 v
y = a2 u + b2 v

giving me:

(e1 u + e2 v + e3) du + (f1 u + f2 v + f3) dv = 0

In particular, I compute:

$$f_2 = 2 b_1^2 + b_2^2$$

So, if I set b1 and b2 so that f2 = 0, then I've eliminated the v dv term.

It seemed the simplest substitution would be:

x = iv
y = u + √2 v

Which yields, after rearrangement (if I've made no errors):

$$\frac{dv}{du} + \frac{\sqrt{2} + i}{i + (\sqrt{2} - i) u} v = \frac{-u}{i + (\sqrt{2} - i) u}$$

Which one can solve with standard methods. The trick is getting a real answer for x and y at the end, but I expect to be able to do so, even if it involves trying put logarithms together to form inverse trig functions.

P.S. I make no claim my approach is better, just that I expect I can do it.

Ok Hurkyl. That's very interesting. I'll work with it.

Edit: Ok, I got the same ODE in v and u as you did with your substitutions so I go on from there (not that I don't trust you or nothing, you know what I mean )

Last edited:
asdf1
wow! thanks! :)
but there's one thing I'm not too clear on...
What the difference between an affine and linear transformation?

Homework Helper
Asdf, one method of handling the solution is to convert it to polar coordinates. Wanna look at that? What will the following look like in a new coordinate system in terms of polar coordinates?

$$\sqrt{2}ln\left[\sqrt{2u^2+v^2}\right]=-ArcTan\left(\frac{v}{u\sqrt{2}}\right)+k$$

You know, convert to polar coordinates, take the exponential, end up with something like:

$$\rho(\theta)=Ke^{f(\theta)}$$

But that will be in a coordinate system different than x and y. What to do to get the plot in terms of x and y?

Homework Helper
I verified the solution by implicit differentiation in Mathematica and then solving for y'[x]. This is the code I used:

Code:
Simplify[Solve[Simplify[
$$\qquad D[\sqrt{2}ln\left[\sqrt{2(x+1/3)^2+(y[x]-1/3)^2}\right]== -ArcTan\left[\frac{y[x]-1/3}{\sqrt{2}(x+1/3)}\right]+k,x]],y'[x]]]$$

Mathematica returns the RHS of the ODE so I have some confidence the solution is correct. Also the results agree with numerical results in a valid region (no vertical slopes).

However, I'm just disappointed that I know of no other way to plot it then the brute-force approach below which just checks every point in the x-y plane that fits the equation using a value of k determined by the IVP: y(0)=1. A plot is attached.

If someone knows of a better way (I'm still looking at Hurkyl's approach but get stuck when evaluating the last integration), please let me know.

Code:
plotlist1 = Table[{0, 0}, {50000}];
index = 0;
For[x = -5, x <= 5, x += 0.01;
For[y = -5, y <= 5, y += 0.01,
$$\quad ytest=\sqrt{2}ln\left[\sqrt{2(x+1/3)^2+(y[x]-1/3)^2}\right]+ArcTan\left[\frac{y[x]-1/3}{\sqrt{2}(x+1/3)}\right]$$
If[Abs[ytest - k] <= 0.01,
index++;
plotlist1[[index]] = {x, y};
];
];
];
plotlist = Take[plotlist1, index];
lp1 = ListPlot[plotlist1, PlotRange -> {{-6, 6}, {-6, 6}}]

#### Attachments

• 882005.JPG
4.9 KB · Views: 404
asdf1
just a thought~
i think that maybe in this case, it looks like it'll be harder if you convert it to polar coordinates... because aren't usually polar coordinates used when you see "x^2+y^2" or something similar? otherwise it'd probably get more complicated~

Homework Helper
closure

Hello Asdf,

I've made progress with this. You're right, polar coordinates is not the way to go. I analyzed it parametrically. In summary, for the IVP:

$$\frac{dy}{dx}=-\frac{(2x-y+1)}{x+y},\quad y(0)=1$$

The solution in parametric form is:

$$x(t)=k_1 e^t Cos[\sqrt{2}t]+k_2e^t Sin[\sqrt{2}t]-1/3$$

$$y(t)=k_1e^t\left(-\sqrt{2}Sin(\sqrt{2}t)\right)+k_2e^t\left(\sqrt{2}Cos(\sqrt{2}t)\right)+1/3$$

with:

$$k_1=\frac{1}{3}$$

$$k_2=\frac{2}{3\sqrt{2}}$$

A plot is attached. It's a logarithmic spiral. Rock and roll.

Edit: The second plot exhibits the vertical slope when x=-y as per the ODE.

#### Attachments

• logspirial.JPG
5.9 KB · Views: 393
• logspiral2.JPG
6.6 KB · Views: 393
Last edited:
asdf1
wow! I missed the thought to analyze it parametrically...
thank you very much!
interesting plot~

Homework Helper
Here's the parametric analysis for those interested.

For:

$$(2x-y+1)dx+(x+y)dy=0,\quad y(0)=1$$

Letting:

$$x=u-1/3$$

$$y=v+1/3$$

We obtain:

$$(2u-v)du+(u+v)dv=0,\quad v(1/3)=2/3$$

or:

$$\frac{dv}{du}=\frac{v-2u}{u+v}$$

Now, this is the same as:

$$\frac{\frac{dv}{dt}}{\frac{du}{dt}}=\frac{v-2u}{v+u}$$

or the system:

$$\frac{dv}{dt}=v-2u,\quad v(0)=2/3$$

$$\frac{du}{dt}=v+u,\quad u(0)=1/3$$

The eigenvalues for which are complex:

$$\lambda_i=1\pm\sqrt{2}i$$

Choosing the positive one and calculating an eigenvector, we obtain for the solution:

$$\left(\begin{array}{c} v \\ u \end{array}\right)=e^{(1+\sqrt{2}i)t} \left(\begin{array}{c} \sqrt{2}i \\ 1 \end{array}\right)$$

Solving using Euler's formula and separating into real and imaginary parts we have for the solution:

$$\left(\begin{array}{c} v \\ u \end{array}\right)=k_1e^t \left(\begin{array}{c} -\sqrt{2}Sin[\sqrt{2}t] \\ Cos[\sqrt{2}t] \end{array}\right)+k_2e^t \left(\begin{array}{c} \sqrt{2}Cos[\sqrt{2}t] \\ Sin[\sqrt{2}t] \end{array}\right)$$

or:

$$x(t)=u(t)-1/3$$

$$y(t)=v(t)+1/3$$

heman
GCT said:
rearrange to

$$2x-y+1 + (x+y)dy = 0$$ and test for exactness

It's clearly not exact and i its i.f. is function is of both x & y,
Salty's way i think is the only way to do it!

Staff Emeritus
Gold Member
Hrm, the last integration seems easy to me...

$$\frac{dv}{du} + \frac{\sqrt{2} + i}{i + (\sqrt{2} - i) u} v = \frac{-u}{i + (\sqrt{2} - i) u}$$

To keep the notation simpler, I'll make the substitutions $w = i + (\sqrt{2} - i) u$ and $\alpha = (\sqrt{2} + i) / (\sqrt{2} - i)$, yielding:

$$\frac{dv}{dw} + \frac{\alpha}{w} v = \frac{i}{(\sqrt{2} - i) w} - \frac{1}{\sqrt{2} - 1}$$

The integrating factor is $w^\alpha$, giving:

$$\frac{d}{dw} \left(w^\alpha v \right) = \frac{i}{\sqrt{2} - i} w^{\alpha - 1} - \frac{1}{\sqrt{2} - 1} w^{\alpha}$$

and the R.H.S. is easy to integrate. Doing so, and dividing by $w^\alpha$ gives, if I've done everything correctly:

$$v = \frac{1 + \sqrt{2} i}{3} - \frac{1}{2\sqrt{2}}w + C w^{-\alpha}$$

Homework Helper
Hurkyl said:
Hrm, the last integration seems easy to me...

$$\frac{dv}{du} + \frac{\sqrt{2} + i}{i + (\sqrt{2} - i) u} v = \frac{-u}{i + (\sqrt{2} - i) u}$$

To keep the notation simpler, I'll make the substitutions $w = i + (\sqrt{2} - i) u$ and $\alpha = (\sqrt{2} + i) / (\sqrt{2} - i)$, yielding:

$$\frac{dv}{dw} + \frac{\alpha}{w} v = \frac{i}{(\sqrt{2} - i) w} - \frac{1}{\sqrt{2} - 1}$$

Hurkyl, I've gone over it 3 times and do not get the same result for the first step as you. This is my work:

Letting:

$$w=i+(\sqrt{2}-i)u$$

Then:

$$u=\frac{w-i}{\sqrt{2}-i}$$

So that:

$$\frac{dv}{dw}=\frac{dv}{du}\frac{du}{dw}=\frac{dv}{du}\frac{1}{\sqrt{2}-i}$$

Substituting into the ODE:

$$(\sqrt{2}-i)\frac{dv}{dw}+\frac{(\sqrt{2}+i)v}{w}=\frac{i-w}{\sqrt{2}-i}\left(\frac{1}{w}\right)$$

Letting alpha be as you suggest leaves:

$$\frac{dv}{dw}+\frac{\alpha}{w}v=\frac{i-w}{w(\sqrt{2}-i)(\sqrt{2}-i)}$$

Simplifying:

$$\frac{dv}{dw}+\frac{\alpha}{w}v=\frac{i}{w(1-2\sqrt{2}i)}-\frac{1}{1-2\sqrt{2}i}$$

Staff Emeritus
Gold Member
Ok fine. Same integrating factor, though, and you still only have to integrate w^k type things.

Homework Helper
I have a question about the complex solution:

So from above we have:

$$\frac{dv}{dw}+\frac{\alpha}{w}v=\frac{i}{w(1-2\sqrt{2}i)}-\frac{1}{1-2\sqrt{2}i}$$

Solving this I obtain:

$$v=\frac{i}{\alpha(\sqrt{2}-i)}-\frac{w}{\sqrt{2}(\alpha+1)}+\frac{K}{w^{\alpha}}$$

with:

$$v=\frac{x}{i},\quad w=i+(\sqrt{2}-i)u,\quad u=y-\frac{\sqrt{2}x}{i},\quad \alpha=\frac{\sqrt{2}+i}{\sqrt{2}-i}$$

Now, I can get this into the form:

$$f(x,y)+g(x,y)i=C$$

However, unlike linear differential equations, as I understand it, neither f(x,y) nor g(x,y) separately are solutions to the differential equation. So how would we get a real solution out of this solution?

Edit: Well wait, it is a linear equation in v and w but both v and w are complex variables as per above. Know what, I think a linear combination of f and g would work.

Last edited:
Staff Emeritus
Gold Member
Plug and grind.

This does bother me, though. We've determined that the base solution for v is affine in w. However, we know that (v, w) is affine in (x, y), so that the base solution for y would be affine in x.

So, we can simply start from there, and make the conjecture that y = mx + b.

Plugging back into the original equation:

(2x - y + 1) + (x + y) y' = 0
2x - mx - b + 1 + (x + mx + b) m = 0
(2 - m + m + m²) x + (-b + 1 + bm) = 0
m² = -2 and b = 1 / (1 - m)
<m, b> = <i√2, (1 + i√2) / 3>

Giving:

y = (i √2)x + (1 + i√2) / 3

And the conjugate solution as well. (using the other square root of 2)

I must say that this rather distrubs me!

Last edited:
Staff Emeritus
Gold Member
P.S.

$$x(t)=k_1 e^t Cos[\sqrt{2}t]+k_2e^t Sin[\sqrt{2}t]-1/3$$
$$y(t)=k_1e^t\left(-\sqrt{2}Sin(\sqrt{2}t)\right)+k_2e^t\left(\sqrt{2} Cos(\sqrt{2}t)\right)+1/3$$

Can be simplified: remember your trigonometry! They're equivalent to:

$$x(t) = A e^t \sin(\sqrt{2} t + B) - 1/3$$
$$y(t) = A \sqrt{2} e^t \cos(\sqrt{2} t + B) + 1/3$$

where $A^2 = k_1^2 + k_2^2$ and $\tan B = k_1 / k_2$.

This gives a nice way to solve for t as -B + Log(f(x, y)) where f is a linear polynomial. You ought to be able to reduce it to a nonparametric equation, but I haven't worked out the details yet.

Last edited:
Homework Helper
Ok, I'll look at your suggestions Hurkyl. Thanks.

However, continuing with the complex analysis, for:

$$v=\frac{i}{\alpha(\sqrt{2}-i)}-\frac{w}{\sqrt{2}(\alpha+1)}+\frac{K}{w^{\alpha}}$$

with:

$$v=\frac{x}{i},\quad w=i+(\sqrt{2}-i)u,\quad u=y-\frac{\sqrt{2}x}{i},\quad \alpha=\frac{\sqrt{2}+i}{\sqrt{2}-i}$$

I obtain:

\begin{align*} \frac{i}{\alpha(\sqrt{2}-i)} &= \frac{1}{3}+\frac{i\sqrt{2}}{3} \\ \\ -\frac{w}{\alpha(\sqrt{2}-i} &= \left(y-\frac{x}{2}-\frac{1}{2}\right)+ i\left(\frac{1}{\sqrt{8}}+\sqrt{2}x+\frac{y}{\sqrt{8}}\right) \\ \\ \frac{K}{w^{\alpha}} &= KExp\left(\frac{ln(r)}{3}+\frac{\sqrt{8}}{3}\theta\right)\left[Cos\left(\frac{\theta}{3}+\frac{\sqrt{8}}{3}ln(r)\right)-iSin\left(\frac{\theta}{3}+\frac{\sqrt{8}}{3}ln(r)\right)\right] \end{align}

With:

$$r=\sqrt{2(x+y)^2+(1+2x-y)^2}$$

$$\theta=ArcTan\left[\frac{1+2x-y}{x+y}\right]$$

It's very messy but can now be placed in a form:

$$f(x,y)+ig(x,y)=C$$

asdf1
@@
my goodness~
that is one tough O.D.E!

Homework Helper
asdf1 said:
@@
my goodness~
that is one tough O.D.E!

Asdf,

All that complex stuf, maybe not necessary and don't wish to give you the impression that the ODE was complex. It wasn't really. Hurkly and I just pursued a different approach which I just left at the point I did. However, the important part is that the solution is attainable via the substitutions suggested and/or the parametric route I chose. The parametric form provides a clean means of plotting the solution and is one I'd suggest using.

However, the other one you proposed up there allows for yet another approach which also can be solved parametrically via differential operators.

I'll make some postings.

Staff Emeritus
Gold Member
Aha! I finally figured out the geometric picture I was searching for.

So, we have the equation:

$$\frac{dy}{dx} = \frac{L_1(x, y)}{L_2(x, y)}$$

where the L's are linear.

The L's are computing the distance from some fixed line. (Times some constant).

dy/dx is computing the slope of the tangent line at (x, y)... or, the tangent of the angle the tangent line makes with the horizontal.

So now we can get a coordinate free picture:

"The tangent of the angle between the tangent line at (x, y) with some fixed line is proportional to the ratio of the distances from (x, y) two these other two fixed lines"

And it suggests a good way to look at the problem: after shifting coordinates so that the two fixed lines intersect at the origin, you should convert to polar coordinates!

My initial stab at the algebra suggests that the computation is straightforward, although tedious and involving the complexes.

By the way, this is a good substitution for trig integrals:

sin θ = 2t / (1 + t²)
cos θ = (1 - t²) / (1 + t²)
dθ = (2 dt) / (1 + t²)

(I think I have dθ right)

asdf1
Yes, you're right~
There's lots of different approaches to a question~
It's just that...
You guys are amazing!
I'd never of thought to come up with those ideas~
It makes me want to start jumping into mathematics books and brush up on my math~

Staff Emeritus
Gold Member
After homogenizing, the generic solution to the polar form looks like the product of these four terms to various powers: (if I haven't made a mistake)

(A + B tan θ + C tan² θ)
exp(arctan(D tan θ + E))
sec θ
exp(θ)

times some constant.

Sigh, not all that enlightening. Everything except the "some constant" depend on the coefficients in the original problem.