Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need to learn how to solve differential equations using either the Exact Equation Approach and or the Special Integrating Factor methods. Below is a differential Equation to solve.

$(2xy^2 + \cos x) \text{d}x + (2x^2 y + \sin y)\text{d}y = 0$

I would appreciate it if you would include comments to explain steps taken. Thanks in advance


Following your example I did the following

Given $$ (2x + y).dx + ( x - 2y).dy = 0$$

a) $$ M(x,y)=2x + y, N(x,y)= x - 2y $$

b) check if the d.e is exact.
$\frac{\partial M}{\partial y}=\frac{\partial}{\partial y}\left(2x + y\right)= 1 =\frac{\partial}{\partial x}\left(x - 2y\right)=\frac{dN}{\partial x}$.

c) $$ f\left(x,y\right)=\int M(x,y)\text{d}x =\int(2x + y)\text{d}x=x^{2} + xy + g(y).$$

d) To find $g\left(y\right)$
$f_{y}\left(x,y\right)=\frac{\partial}{dy}\left(x^{2}+ xy + g(y)\right)=0 + x + g'\left(y\right).$

e) Upon comparing with $N\left(x,y\right)$, I find $g'\left(y\right)= - 2y$ which implies that $g\left(y\right)=- y^{2}+K$

Therefore, the general solution is $ x^2 + xy - y^2 =C$.

share|improve this question
1  
You have been given nice answers but just in the case you wondered what the word exact really means: it comes from differential geometry. A differential form $\omega$ is exact if there exist a potential form $\alpha$ such that $\omega = {\rm d} \alpha$ where ${\rm d}$ is an exterior derivative. On the other hand, the form is closed if ${\rm d} \omega = 0$. From the commutation of second partial derivatives one has ${\rm d}^2 \omega = 0$, i.e. every exact form is closed. But when working on ${\mathbb R}^n$ the opposite also holds: a closed form is exact, i.e. you can find a potential. –  Marek Jun 21 '11 at 15:03
1  
@user1065: You missed out the term $xy$ when computing $f_y(x,y)$. Otherwise, everything else is perfect!! –  Nana Jun 21 '11 at 19:45
    
thank you very much –  user10695 Jun 22 '11 at 18:34

4 Answers 4

This is an exact equation.

An equation $$A(x,y) dx + B(x,y)dy=0$$ is called exact if there is a function $F(x,y)$ such that $$A(x,y)=\frac{\partial F}{\partial x}\qquad\text{and}\qquad B(x,y)=\frac{\partial F}{\partial y} \qquad\text{(Equations $1, 2$)}$$

In that case, the general solution of the differential equation then has the shape $$F(x,y)=C, \qquad\text{where $C$ is any constant}.$$

From any given initial condition, $C$ can be determined. In general, from $F(x,y)=C$ you will not be able to determine $y$ explicitly in terms of $x$.

In your problem, we have $A(x,y)=2xy^2+\cos x$ and $B(x,y)=2x^2y+\sin y$. We wish to find a function $F(x,y)$ such that Equations $1$ and $2$ hold.

Right now, you have no assurance that there is such a function $F(x,y)$, except for my assertion that the equation is exact. Later, I will give a criterion that enables you to test for exactness before embarking on a possibly fruitless quest for a $F(x,y)$ that satisfies Equations $1$ and $2$.

But for now, let's look for such a $F(x,y)$. Remember, we are using partial derivatives.

So we want $F(x,y)$ to be kind of an integral of $2xy^2+\cos x$ with respect to $x$, where $y$ is treated as a constant.

Integrate in the usual way. What should $F(x,y)$ look like?

We get $F(x,y)=x^2y^2 +\sin x$, sort of. But remember that $y$ is being treated as a constant, so the general integral of $2xy^2+\cos x$ with respect to $x$ has shape $$F(x,y)=x^2y^2 + \sin x + a(y) \qquad (3)$$ where $a(y)$ is any function of $y$. This is because when we take the partial derivative of this with respect to $x$, the $a(y)$ is treated as a constant and disappears.

Now let's find a general formula for $F(x,y)$ such that the partial derivative of $F(x,y)$ with respect to $y$ is $2x^2y+\sin y$. By the same reasoning as before, we should have $$F(x,y)=x^2y^2 -\cos y +b(x) \qquad (4)$$ where $b(x)$ is any function of $x$.

Now look at ($3$) and ($4$). How can we make them exactly the same? You can see that we need $a(y)=-\cos y$ and $b(x)=\sin x$.

So an $F(x,y)$ that works is given by $$F(x,y)=x^2y^2+ \sin x -\cos y$$

It follows that the general solution of your differential equation is $$x^2y^2 +\sin x -\cos y=C$$ It is absolutely hopeless to solve this implicit equation explicitly for $y$ in terms of $x$.

You can check whether your answer is a solution to the original DE by calculating the derivative of $F(x,y)$ with respect to $x$. This time, be sure to use the implicit differentiation that you learned in calculus classes.

A Test for Exactness: The equation $$A(x,y) dx + B(x,y)dy=0$$ is exact precisely if $$\frac{\partial A}{\partial y}=\frac{\partial B}{\partial x}$$ (This follows from the fact that mixed partials are equal).

So before you embark on the search for $F(x,y)$, you might as well use the simple test above to check whether such an $F(x,y)$ exists. (Partial) differentiation is generally easy, so testing for exactness doesn't take much time. Check whether our $A(x,y)$ and $B(x,y)$ pass the test. This really should have been done at the beginning, but I was in a hurry to get to the solution.

share|improve this answer
    
Do I just assume that one can make them the same? I mean concat (3) and (4) without needing to show this? $a(y)=-\cos y$ and $b(x)=\sin x$. –  user10695 Jun 21 '11 at 17:52
    
@user10695: You are saying that a glance at the two equations shows that $a(y)=-\cos y$ and $b(x)=\sin x$, so now we know $F(x,y)$. Yes, that is also exactly what I was saying. I did not do any "showing", none was needed. Looks as if you understand the process fully. Do be diligent in checking. It would be a shame to get a question wrong that you know how to do. –  André Nicolas Jun 21 '11 at 18:02

Note that the d.e is of the form $M(x,y)\text{d}x+N(x,y) \text{d}y$ with
$$ M(x,y)=2xy^2+\cos (x),~N(x,y)=2x^2y+\sin (y) $$
and the equation is exact if and only if $\displaystyle\frac {\partial M}{\partial y}=\frac{\partial N}{\partial x}.$

Now lets check if the differential equation is indeed exact.

$\displaystyle\frac{\partial M}{\partial y}=\frac{\partial}{\partial y}\left(2xy^{2}+\cos x\right)=4xy=\frac{\partial}{\partial x}\left(2x^{2}y+\sin y\right)=\frac{dN}{\partial x}$.

So the equation is exact.

The general solution is of the form $f\left(x,y\right)=C$ and it's given by

$$ f\left(x,y\right)=\int M(x,y)\text{d}x =\int(2xy^{2}+\cos x)\text{d}x=x^{2}y^{2}+\sin(x)+ g(y).$$ To find $g\left(y\right)$ differentiate $f\left(x,y\right)$ partially with respect to $'y'$ and compare with $N\left(x,y\right).$

That is: $f_{y}\left(x,y\right)=\dfrac{\partial}{dy}\left(x^{2}y^{2}+\sin x+g(y)\right)=2x^{2}y+g'\left(y\right).$ Comparing with $N\left(x,y\right)$, we find $g'\left(y\right)=\sin y,$ which implies that $g\left(y\right)=-\cos y+K$.
Hence, the general solution is $ x^2y^2+\sin x-\cos y=C.\quad\quad\Box$

Added

What happens if $M(x,y)\text{d}x+N(x,y)\text{d}y=0$ is not exact? Then there exist a function $u(x,y)$ such that $$[u(x,y)M(x,y)]\text{d}x+[u(x,y)N(x,y)]\text{d}y=0$$ is exact. The function $u$ is called an integrating factor. Furthermore, If $$\frac{M_y-N_x}{N}$$ is a function of $x$ only, say, $v(x)$, then $u(x,y)=u(x)=e^{\int v(x)\text{d}x}$.
On the other hand if $$\frac{M_y-N_x}{-M}$$ is a function of $y$ only, say, $w(y)$, then $u(x,y)=u(y)=e^{\int w(y)\text{d}y}$.

As an example, consider $(3xy-y^2)\text{d}x+(x^2-xy)\text{d}y=0$. Clearly, this is not exact. But $\dfrac{M_y-N_x}{N}=\dfrac{1}{x}=v(x)$, a function of $x$ only. So our integrating factor becomes $$u(x)=e^{\int \frac{1}{x}\text{d}x}=e^{\ln |x|}=|x|.$$
Verify that $$(3x^2y-xy^2)\text{d}x+(x^3-x^2y)\text{d}y=0$$ is now exact!
We now proceed as before to find the general solution.

share|improve this answer
    
Why $$ \int2xy^{2}+\cos x\text{d}x=x^{2}y^{2}+\sin x+ g(y).$$ and not $$ \int2xy^{2}+\cos x\text{d}x=x^{2}y^{3}/3+\sin x+ g(y).$$ –  user10695 Jun 21 '11 at 16:15
    
@user1065: we are integrating with respect to $x$, not $y$. –  Nana Jun 21 '11 at 16:21
    
@user1065: $$\int (2xy^2+\cos x)\text{d}x \neq x^2y^3/3+\sin x + g(y)$$ –  Nana Jun 21 '11 at 16:30
    
One other question. Where did the $ \sin x $ in $ \frac{\partial}{dy}\left(x^{2}y^{2}+\sin x+g(y)\right)=2x^{2}y+g'\left(y\right) $ go? –  user10695 Jun 21 '11 at 16:37
1  
@user1065: There is a slight problem with your evaluation of the integral. $\int(2x+y)\text{d}x=x^2+xy+g(y)\neq x^2+g(y)$. –  Nana Jun 21 '11 at 18:45

We take the differential equation to be of the form $M(x,y) \mathrm{d}x + N(x,y) \mathrm{d}y = 0$ .

This satisfies the condition for exactness since $\mathrm{d}M/\mathrm{d}y = \mathrm{d}N/\mathrm{d}x$.

Now our first step is to integrate $M(x,y) = 2xy^{2} + \cos(x)$ with respect to $x$, (note that for now we will ignore the constant of integration).

$$\int \left(2xy^{2} + \cos(x) \right) dx = x^{2}y^{2} + \sin(x) $$

We now integrate $N(x,y) = 2x^{2}y + \sin(y)$ with respect to $y$.

$$\int \left(2x^2y + \sin(y) \right) \ dy = x^2y^2 - \cos(y)$$

Now we just combine terms (counting similar terms only once) and set it equal to a constant to get our family of solutions.

$$x^{2}y^{2} + \sin(x) -\cos(y)=c$$

share|improve this answer
1  
I'd say this is a little opaque for some one new to the stuff. How did you combine those terms? You obviously didn't add them. What is really going on is that one is integrating one variable at a time and reducing dependence of the "integration constant" until it is really just a constant (and this is guaranteed by exactness). –  Marek Jun 21 '11 at 14:21
    
what about the other side of the equation? –  user10695 Jun 21 '11 at 14:33
    
@user10695 There are much more detailed answers above. My solution, while correct, skips over what is actually going on and just solves the equation. –  Mike McLeod Jun 21 '11 at 14:54
    
@Marek You're right. This was not the best way to present the solution to a newcomer. I was going to edit it, but there are already some much more thorough answers above, so I will leave it as is. –  Mike McLeod Jun 21 '11 at 14:55

This question has several good answers already, but here's my attempt at an explanation that avoids differential forms notation, and emphasizes that we're using the multivariable chain rule in reverse.

Consider the ODE \begin{equation} p(x,y(x)) + q(x,y(x)) y'(x) = 0. \end{equation} (Assume that $p$ and $q$ are continuously differentiable in a rectangle $R = (a,b) \times (c,d)$.)

If we can find a function $F$ such that $\frac{\partial F}{\partial x} = p$ and $\frac{\partial F}{\partial y} = q$, then (by the multivariable chain rule) \begin{align} \frac{d}{dx} \, F(x,y(x)) &= \frac{\partial F(x,y(x))}{\partial x} + \frac{\partial F(x,y(x))}{\partial y} y'(x) \\ &= p(x,y(x)) + q(x,y(x)) y'(x) \end{align} and our ODE can be written as \begin{equation} \frac{d}{dx} \, F(x,y(x)) = 0. \end{equation} We can now take anti-derivatives of both sides to obtain \begin{equation} F(x,y(x)) = k \end{equation} (for some constant $k$) and solve for $y(x)$.

When is it possible to find such a function $F$? One observation is that if such an $F$ exists, then $\frac{\partial^2 F}{\partial y \partial x} = \frac{\partial p}{\partial y}$, and $\frac{\partial^2 F}{\partial x \partial y} = \frac{\partial q}{\partial x}$. By equality of mixed partials, we see that \begin{equation} \frac{\partial p}{\partial y} = \frac{\partial q}{\partial x}. \end{equation} This is a necessary condition for such an $F$ to exist. When this condition is satisfied, our ODE is said to be "exact".

It turns out that this condition is also sufficient. To see this, assume that $\frac{\partial p}{\partial y} = \frac{\partial q}{\partial x}$, and let's find an $F$ that works.

Let $P$ be an anti-derivative of $p$ with respect to $x$. From the requirement that $\frac{\partial F}{\partial x} = p$, we get \begin{equation} F(x,y) = P(x,y) + C(y) \end{equation} for some function $C(y)$. ($y$ is now being used as a "dummy variable".)

The requirement that $\frac{\partial F}{\partial y} = q$ gives us \begin{align} \frac{\partial F(x,y)}{\partial y} &= \frac{\partial P(x,y)}{\partial y} + C'(y) \\ &= q(x,y) \end{align} which implies that \begin{equation} C'(y) = q(x,y) - \frac{\partial P(x,y)}{\partial y}. \end{equation} This equation might seem impossible at first, because the right hand side apparently depends on $x$, whereas the left hand side depends only on $y$. However, if you take the derivative of the right hand side with respect to $x$, and use our assumption that $\frac{\partial p}{\partial y} = \frac{\partial q}{\partial x}$, you get $0$. This shows that the right hand side actually does not depend on $x$ after all.

In summary, to find $F$, let $P$ be an anti-derivative of $p$ with respect to $x$, pick $C(y)$ such that $C'(y) = q(x,y) - \frac{\partial P(x,y)}{\partial y}$, and let $F(x,y) = P(x,y) + C(y)$.

Alternatively, we could let $Q$ be an anti-derivative of $q$ with respect to $y$, and find an $F$ of the form $F(x,y) = Q(x,y) + C(x)$.


In the problem in this question, we have \begin{equation} p(x,y) = 2xy^2 + \cos(x) \end{equation} and \begin{equation} q(x,y) = 2x^2y + \sin(y). \end{equation}

Note that $\frac{\partial p(x,y)}{\partial y} = \frac{\partial q(x,y)}{\partial x} = 4xy$, so the ODE is exact.

$P(x,y) = x^2 y^2 + \sin(x)$ is an anti-derivative of $p$ with respect to $x$. We want to find $C(y)$ such that \begin{align} C'(y) &= q(x,y) - \frac{\partial P(x,y)}{\partial y} \\ &= 2x^2 y + \sin(y) - 2x^2 y \\ &= \sin(y). \end{align} So let $C(y) = -\cos(y)$, and let \begin{align} F(x,y) &= P(x,y) + C(y) \\ &= x^2 y^2 + \sin(x) - \cos(y). \end{align} Then $\frac{\partial F}{\partial x} = p$ and $\frac{\partial F}{\partial y} = q$. The solution to our ODE is $F(x,y(x)) = k$, or in other words \begin{equation} x^2 \, y(x)^2 + \sin(x) - \cos(y(x)) = k. \end{equation}

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.