# I Using complex numbers or phasor transform to solve O.D.E's

#### K Murty

Hi
particular solution only.
As an example of what I am talking about, this method works for this DE:
$$4y' + 2y = 10\cos(x) \\ \\ 10 \cos(x) = \Re( 10 e^{j(x)} ) = \Re(e^{j(x)} \cdot e^{j(0)} ) \rightarrow \text{complex number that captures the amplitude and phase of 10 cos x is} \\ 10 \angle{0} = 10 \\ \text{using the property of exponentials that} {\dfrac{d^{n}}{dx^{n}} e^{j(ax) } = {(aj)}^{n} e^{j(ax) }} \\ \\ \text{Since forcing function is sinusoid y is a sinusoid too of the same angular velocity} \\ \\ a = 1\\ \text{Angular velocity is one} \\ \\ 4J y + 2y = 10\angle{0} \\ \\ y (4J + 2) = 10\angle{0} \\ y = \dfrac{ 10\angle{0} }{2 + 4J } \\ \dfrac{ 10}{ \sqrt{2^2 + 4^2} } \angle{ - \arctan(\frac{4}{2}) } \rightarrow \sqrt{5} \cos(x - \arctan(2) ) \\ \\ y_{p} = \sqrt{5} \cos(x - \arctan(2) )$$

But it does not work for certain ODE, especially those that I think are in resonance:
$$y''' - 4y' = 4 \sin(2x)$$
For the function above, I got the answer as:
$$y_{p} = \dfrac{1}{4} \cos(2x)$$
But the wolfram alpha displays the answer for the particular solution as:
$$\dfrac{ \cos^2(x)}{2}$$
In this one other example, the method leads to a contradiction:
$$y'' + y = \cos(x) \\ \text{Solving using method above leads to contradiction} \\ y \cdot 0 = 1$$
My general questions are, how can I know when to avoid using complex numbers to find the particular solution of ODES?
And secondly, can anyone refer me to something that explains how to solve an ODE in resonance when the forcing function is a trigonometric function (sinusoids only)?

Last edited:
Related Differential Equations News on Phys.org

#### Mark44

Mentor
Hi
particular solution only.
As an example of what I am talking about, this method works for this DE:
$$4y' + 2y = 10\cos(x) \\ \\ 10 \cos(x) = \Re( 10 e^{j(x)} ) = \Re(e^{j(x)} \cdot e^{j(0)} ) \rightarrow \text{complex number that captures the amplitude and phase of 10 cos x is} \\ 10 \angle{0} = 10 \\ \text{using the property of exponentials that} {\dfrac{d^{n}}{dx^{n}} e^{j(ax) } = {(aj)}^{n} e^{j(ax) }} \\ \\ \text{Since forcing function is sinusoid y is a sinusoid too of the same angular velocity} \\ \\ a = 1\\ \text{Angular velocity is one} \\ \\ 4J y + 2y = 10\angle{0} \\ \\ y (4J + 2) = 10\angle{0} \\ y = \dfrac{ 10\angle{0} }{2 + 4J } \\ \dfrac{ 10}{ \sqrt{2^2 + 4^2} } \angle{ - \arctan(\frac{4}{2}) } \rightarrow \sqrt{5} \cos(x - \arctan(2) ) \\ \\ y_{p} = \sqrt{5} \cos(x - \arctan(2) )$$

But it does not work for certain ODE, especially those that I think are in resonance:
$$y''' - 4y' = 4 \sin(2x)$$
For the function above, I got the answer as:
$$y_{p} = \dfrac{1}{4} \cos(2x)$$
But the wolfram alpha displays the answer for the particular solution as:
$$\dfrac{ \cos^2(x)}{2}$$
Your solution and wolframalpha's differ only by a constant, so both are solutions. $\cos^2(x) = \frac 1 2 \cos(2x) + \frac 1 2$. A bit of algebra gets you from wolfram's solution to yours (disregarding the constant).
K Murty said:
In this one other example, the method leads to a contradiction:
$$y'' + y = \cos(x) \\ \text{Solving using method above leads to contradiction} \\ y \cdot 0 = 1$$
A basis for the solution set of y'' + y = 0 (the homogeneous equation) is $\{\sin(x), \cos(x) \}$, so no multiple of either of these will do for a particular solution of your nonhomogeneous equation. Try $y_p = Ax\cos(x) + Bx\sin(x)$ for a particular solution, and substutute into the nonhomogeneous equation to solve for the coefficients A and B.

One technique that can be used is the method of annihilators. I wrote an Insights article (https://www.physicsforums.com/insights/solving-nonhomogeneous-linear-odes-using-annihilators/) on this technique, which can be used on nonhomogeneous DEs. There's another one, https://www.physicsforums.com/insights/solving-homogeneous-linear-odes-using-annihilators/, that deals with homogeneous DEs.
K Murty said:
My general questions are, how can I know when to avoid using complex numbers to find the particular solution of ODES?
And secondly, can anyone refer me to something that explains how to solve an ODE in resonance when the forcing function is a trigonometric function (sinusoids only)?
See my comment above.

• K Murty

#### K Murty

Your solution and wolframalpha's differ only by a constant, so both are solutions. $\cos^2(x) = \frac 1 2 \cos(2x) + \frac 1 2$. A bit of algebra gets you from wolfram's solution to yours (disregarding the constant).
A basis for the solution set of y'' + y = 0 (the homogeneous equation) is $\{\sin(x), \cos(x) \}$, so no multiple of either of these will do for a particular solution of your nonhomogeneous equation. Try $y_p = Ax\cos(x) + Bx\sin(x)$ for a particular solution, and substutute into the nonhomogeneous equation to solve for the coefficients A and B.

One technique that can be used is the method of annihilators. I wrote an Insights article (https://www.physicsforums.com/insights/solving-nonhomogeneous-linear-odes-using-annihilators/) on this technique, which can be used on nonhomogeneous DEs. There's another one, https://www.physicsforums.com/insights/solving-homogeneous-linear-odes-using-annihilators/, that deals with homogeneous DEs.
See my comment above.
Thanks a lot, I will read the insights too. :) #### Mark44

Mentor
By the way, there are at least two other ways to solve the first DE you listed, both of which are simpler.

Here's one of them.
4y' + 2y = 10cos(x)
The related homogeneous DE is
4y' + 2y = 0, or equivalently 2y' + y = 0

This is a linear, constant coefficent homogeneous DE.
Try a solution of the form $y = e^{rx}$
Then $y' = re^{rx}$
Substituting, we get $2re^{rx} + e^{rx} = 0 \Rightarrow (2r + 1)e^{rx} = 0$
Solve for r to get r = -1/2
Solution of homogeneous problem: $y_h = Ce^{-x/2}$

For the nonhomogeneous problem 4y' + 2y = 10cos(x), try a solution of the form $y_p = A\cos(x) + B\sin(x)$.
Substitute this into the DE and solve for the coefficients A and B.
The general solution will be $y_h + y_p$, or in this case, $y = Ce^{0.5x} + 1\cos(x) + 2\sin(x)$
To get a value for the constant C, you need an initial condition.

• K Murty

### Want to reply to this thread?

"Using complex numbers or phasor transform to solve O.D.E's"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving