# Obtaining Differential Equations from Functions

I can now recognise the order and the type of differential equations.Let's say $$\frac{dy}{dx} = x^2 - 1$$ is a first order ODE, $$\frac{d^2y}{dx^2} + 2\left(\frac{dy}{dx}\right)^2 + y = 0$$ is a second order ODE and so on. I am having trouble to obtain a differential equation from a given function. I could find the differential equation for $y = e^x(A \cos x + B \sin x)$ and the steps that I followed are as follows.

\begin{align*} \frac{dy}{dx} &= e^x(A \cos x + B \sin x) + e^x(-A \sin x + B \cos x) \\ &= y +e^x(-A \sin x + B \cos x) \tag{1} \\ \frac{d^2 y}{dx^2} &= \frac{dy}{dx} + e^x(-A \sin x + B \cos x) + e^x(-A \cos x - B \sin x) \\ &= \frac{dy}{dx}+\left(\frac{dy}{dx} - y\right) - y \end{align*} using the orginal function and $(1)$. Finally, $$\frac{d^2y}{dx^2} - 2 \frac{dy}{dx} + 2y = 0 ,$$ which is the required differential equation.

Similarly, if the function is $y=(A\cos2t + B\sin2t)$, the differential equation that I get is $$\frac{d^2y}{dx^2} + 4y = 0$$ following similar steps as above.

My question is how do I obtain the differential equations for the following functions using similer procedures

$$y = Ae^{3x} + Be^{2x}$$

$$xy = Ae^{x} + Be^{-x} + x^{2}$$

I am not looking for a solution in determinant form using vector spaces or any other linear algebra/matrices.Please provide step by step solution for the function in order to obtain a particular differential equation.

-
As I already said in your other question: for $y = Ae^{3x} + Be^{2x}$, take the first two derivatives, and see which common expressions can be eliminated. – J. M. Sep 1 '11 at 5:36
J.M This is the 10th time i'am taking the 2nd derivative and i get anywhere. – alok Sep 1 '11 at 6:08
There's the shortcut of determining the characteristic equation first (e.g. $(y+3)(y+2)$ and then replacing the powers with the appropriate derivatives... but I don't recommend it. – J. M. Sep 1 '11 at 6:14
I do not understand the downvote. Can the downvoter at least explain the reasons for the vote, and possibly suggest improvements? – Srivatsan Sep 3 '11 at 1:28

Generally, in such problems, if the function involves $k$ arbitrary constants, we expect to differentiate $k$ times. Then, we should eliminate the arbitrary constants and obtain a differential equation in terms of $$y, \frac{dy}{dx}, \frac{d^2y}{dx^2}, \ldots, \frac{d^ky}{dx^k}.$$

We will see how this works out in the case of $$y = Ae^{3x} + Be^{2x} . \tag{1}$$ Since there are two arbitrary constants $A$ and $B$, we expect to involve $y$ and its first two derivatives. Differentiating twice, we get $$\frac{dy}{dx} = 3A e^{3x} + 2B e^{2x}, \tag{2}$$ and $$\frac{d^2 y}{dx^2} = 9 A e^{3x} + 4B e^{2x}. \tag{3}$$

Now, how do we eliminate $A$ and $B$ from these equations? We can eliminate $B$ from $(2)$ and $(3)$ by subtracting a suitable multiple of $(1)$. That is, $(2) - 2 \times (1)$ gives:
$$\frac{dy}{dx} - 2y = A e^{3x}. \tag{4}$$ Similarly, $(3) - 4 \times (1)$ gives: $$\frac{d^2y}{dx^2} - 4y = 5 A e^{3x}. \tag{5}$$

To get the differential equation, we now need to similarly eliminate $A$ from these equations $(4)$ and $(5)$. Do you see how?

-
Sweet..I'll certainly get back to this problem.Let me finish having my breakfast! – alok Sep 3 '11 at 5:42
Ok,I multiplied (4) by 5 and subtracted with (5) to get 5dy/dx - d^2y/dx^2 - 6y = 0 as secondorder ODE.Thank you so much for yout time. – alok Sep 3 '11 at 6:07
@alok You're welcome. – Srivatsan Sep 3 '11 at 13:03
@alok Given the disagreement between us in the other post, I think it will be more comfortable for both us if I make this answer community wiki. That way, you can remain assured that I do not care only about my reputation points. – Srivatsan Sep 5 '11 at 14:25

An answer has already been given for $y=Ae^{3x}+Be^{2x}$, so we deal with $$xy=Ae^x+Be^{-x}+x^2 \qquad\text{(Equation 1)}$$

Differentiate both sides of the given equation twice with respect to $x$. We first get $$x\frac{dy}{dx}+y=Ae^x-Be^{-x}+2x,\qquad\text{(Equation 2)}$$ and then, differentiating again, $$x\frac{d^2y}{dx^2}+2\frac{dy}{dx}=Ae^x+Be^{-x}+2 \qquad\text{(Equation 3)}$$

Now look at Equation $1$ and Equation $3$. The term $Ae^x+Be^{-x}$ occurs in each. Subtract, and it disappears. We obtain $$x\frac{d^2y}{dx^2}+2\frac{dy}{dx}-xy=2-x^2.$$

-
Why should i even compare equation 1 and 3?how can i subtract without equating the two?Please help – alok Sep 1 '11 at 6:25
The third equation says $P=Q$. The first says $R=S$. From this it follows that $P-R=Q-S$. Or if you want to do it the long way, use the first equation to solve for $Ae^x+Be^{-x}$. You will get $Ae^x+Be^{-x}=xy-x^2$. Substitute $xy-x^2$ for $Ae^x+Be^{-x}$ in the third equation. – André Nicolas Sep 1 '11 at 6:35

Eliminate $a$ and $b$ from $$y = ae^{2x} +be^{3x}\tag{1}$$

$$\frac{dy}{dx} = 2ae^{2x} + 3be^{3x}\tag{2}$$

$$d^2y/dx^2 = 4ae^{2x} + 9be^{3x}\tag{3}$$

$(1)\cdot 2 -(2)$ we get

$$2y - \frac{dy}{dx} = -be^3x$$

$$b = e^{-3x} \left(\frac{dy}{dx} - 2y\right)\tag{4}$$

$(2)*2 - (3)$

$$2 \frac{dy}{dx} - \frac{d^2y}{dx^2} = - 3 b e^{3x}$$

$$b = 1/ 3e ^{3x} \left(\frac{d^2y}{dx^2} - 2 \frac{dy}{dx}\right)\tag{5}$$

compare $(4)$ and $(5)$

$$(dy/dx - 2y) = 1/3 \left(\frac{d^2y}{dx^2} - 2 \frac{dy}{dx}\right)$$

$$3\frac{dy}{dx} - 6y = \frac{d^2y}{dx^2} -2 \frac{dy}{dx}$$

$$\frac{d^2y}{dx^2} -5 \frac{dy}{dx} + 6y = 0$$

-
Welcome to Math.SE! Please see whether I changed the meaning of anything, it was hard to predict the behaviour of some fractions. You can learn how to use $\LaTeX$ here. – Ian Mateus Dec 26 '13 at 16:13