Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How to solve the given initial-value problem?

Writer Mia Lopez
$\begingroup$

Solve the given problem which the input function $g(x)$ is discontinuous?

$y''+4y = g(x)$, $y(0) = 1$, $y'(0) = 2$, where

$$g(x) = \begin{cases} \sin x, & 0\leq x\leq\frac{\pi}{2}\\ 0,& x>\frac{\pi}{2} \end{cases}$$

And the given answer is,

$$y = \begin{cases} \cos 2x+\frac56\sin2x+\frac13\sin x, & 0\leq x\leq\frac{\pi}{2}\\ \frac23\cos 2x+\frac56\sin2x,& x>\frac{\pi}{2} \end{cases}$$

$\endgroup$ 3

2 Answers

$\begingroup$

Note: It is best to use Laplace Transforms for these sorts of problems and this is where the LT shows it's usefulness, but that is not allowed, so we will use undetermined coefficients instead.

We are given:

$\tag 1 y''+4y = g(x), y(0) = 1, y'(0) = 2$

where

$$g(x) = \begin{cases} \sin x, & 0\leq x\leq\frac{\pi}{2}\\ 0,& x>\frac{\pi}{2} \end{cases}$$

The approach will be as mentioned by D.F. in comments, we are going to solve for the lower interval and use that result to solve the upper interval (in essence, we are solving two ODEs).

We start out by finding the homogeneous solution to $(1)$, so we have:

$$m^2 + 4 = 0 \rightarrow m_{1,2} = \pm 2i$$

This gives us:

$$y_h = c_1 \cos 2x + c_2 \sin 2x$$

Next, we will solve for the particular solution, so we guess at a solution of the form:

$$y_p = a \cos x + b \sin x$$

To solve for the constants, $a$ and $b$, we substitute back into $(1)$, yielding:

$-a \cos x - b \sin x + 4a \cos x + 4b \sin x = \sin x$

This yields $a = 0$ and $b = \dfrac{1}{3}$.

So, we can write our solution as: $y = y_h + y_p = c_1 \cos 2x + c_2 \sin 2x + \dfrac{1}{3} \sin x$

Using the IC's, we solve for $c_1$ and $c_2$, yielding $c_1 = 1, c_2 = \dfrac{5}{6}$, so we have:

$$\tag 2 y(x) = \cos 2x + \dfrac{5}{6} \sin 2x + \dfrac{1}{3} \sin x, 0 \le x \le \dfrac{\pi}{2}$$

Next, we want to solve for the upper upper half of the range, so we have, $y'' + 4y = 0$, but we need ICs. We will use $(2)$ to generate an IC at $\dfrac{\pi}{2}$ (do you know what allows us to do this and why it is useful to do so?).

So, using $(2)$, we get $y\left(\dfrac{\pi}{2}\right) = -\dfrac{2}{3}$ and $y'\left(\dfrac{\pi}{2}\right) = -\dfrac{5}{3}$.

We have our solution for $(2)$ from earlier as: $y = c_1 \cos 2x + c_2 \sin 2x$

Using these new ICs, we arrive at, $c_1 = \dfrac{2}{3}, c_2 = \dfrac{5}{6}$, so:

$$\tag 3 y(x) = \dfrac{2}{3} \cos 2x + \dfrac{5}{6} \sin 2x, x \gt \dfrac{\pi}{2}$$

Using $(2)$ and $(3)$, the solution can be written as:

$$y(x) = \begin{cases} \cos 2x + \dfrac{5}{6} \sin 2x + \dfrac{1}{3} \sin x, & 0\leq x\leq\frac{\pi}{2}\\ \dfrac{2}{3} \cos 2x + \dfrac{5}{6} \sin 2x,& x>\frac{\pi}{2} \end{cases}$$

$\endgroup$ 3 $\begingroup$

First let $g(x)=\sin(x)$.

$$ \begin{align*} y'' + 4y &= \sin(x) \end{align*} $$

Applying the Laplace transform to both sides gives

\begin{align*} s^2Y(s)-s-2+4Y(s) &= \dfrac{1}{s^2+1}\\ Y(s)(s^2+4) &= \dfrac{1}{s^2+1}+s+2\\ Y(s) &= \dfrac{1}{(s^2+1)(s^2+4)}+\dfrac{s}{s^2+4}+\dfrac{2}{s^2+4}\\ \end{align*} Via partial fraction decomposition we get \begin{align*} Y(s) &= \dfrac{1}{3(s^2+1)}-\dfrac{1}{3(s^2+4)}+\dfrac{s}{s^2+4}+\dfrac{2}{s^2+4}\\ \end{align*} Thus the inverse Laplace transform gives the desired solution: $$y(x) = \frac{1}{3}\sin(x) - \frac{5}{6}\sin(2x)+\cos(2x)$$

For $g(x)=0$, we have $$\begin{align*}y'' + 4y &= 0\\ \end{align*}$$ Let us make the ansatz that $y(x)=e^{\lambda x}$. Thus, $$\begin{align*} \lambda^2e^{\lambda x} + 4e^{\lambda x} &= 0\\ \lambda^2 + 4 &= 0\\ \end{align*}$$ Hence $\lambda = \pm 2i$, and the general solution is: $$\begin{align*} y(x) &= c_1 e^{2ix} + c_2e^{-2ix}\\ &=c_1(\cos(2x)+i\sin(x))+c_2(\cos(2x)-i\sin(2x))\\ &=(c_1+c_2)\cos(2x)+i(c_1-c_2)\sin(2x)\\ &=k_1\cos(2x)+k_2\sin(2x) \end{align*}$$ where the last line simply redefines our constants, since they are already arbitrary. To satisfy initial conditions, $k_1=k_2=1$, which gives the specific solution

$$ y(x) = \cos(2x)+\sin(2x) $$

In conclusion, the piecewise function is

$$y(x) = \begin{cases} \frac{1}{3}\sin(x) - \frac{5}{6}\sin(2x)+\cos(2x) & \text{if } 0 \leq x \leq \frac{\pi}{2} \\ \cos(2x)+\sin(2x) & \text{if } x > \frac{\pi}{2} \end{cases}$$

$\endgroup$ 1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy