(a) Solve the differential equation [tex]\left(x^2 + xy\right) \frac{dy}{dx} = xy + y^2[/tex].

(b) Solve the differential equation [tex]\frac{d^2 y}{dx^2} - 9y = 7e^{5x}[/tex] given that [tex]y(0) = 2[/tex] and [tex]\frac{dy}{dx}(0) = 3[/tex].



Answer :

Certainly! Let's solve the given differential equations step-by-step.

### Part (a)

To solve the differential equation
[tex]\[ \left(x^2 + xy\right) \frac{dy}{dx} = xy + y^2, \][/tex]
we can start by rewriting it in the form:
[tex]\[ (x^2 + xy) \frac{dy}{dx} = y(x + y). \][/tex]

To solve it, we divide both sides by [tex]\(y(x+y)\)[/tex]:
[tex]\[ \frac{(x^2 + xy)}{y(x+y)} \frac{dy}{dx} = 1. \][/tex]

Simplify the left-hand side:
[tex]\[ \frac{x(x + y)}{y(x + y)} \frac{dy}{dx} = 1. \][/tex]

This simplifies to:
[tex]\[ \frac{x}{y} \frac{dy}{dx} = 1. \][/tex]

Now rearrange it to separate the variables:
[tex]\[ \frac{dy}{y} = \frac{dx}{x}. \][/tex]

Integrate both sides:
[tex]\[ \int \frac{1}{y} \, dy = \int \frac{1}{x} \, dx, \][/tex]

which results in:
[tex]\[ \ln|y| = \ln|x| + C, \][/tex]
where [tex]\(C\)[/tex] is the constant of integration.

Exponentiate both sides:
[tex]\[ y = Cx, \][/tex]
where [tex]\(C\)[/tex] can be represented as [tex]\(C_1 = e^C\)[/tex]. Thus, the general solution to the differential equation is:
[tex]\[ y = C_1 x. \][/tex]

This is the solution to part (a).

### Part (b)

To solve the differential equation
[tex]\[ \frac{d^2 y}{dx^2} - 9y = 7e^{5x}, \][/tex]
with initial conditions [tex]\(y(0) = 2\)[/tex] and [tex]\(\frac{dy}{dx}\bigg|_{x=0} = 3\)[/tex], we need to find the general solution to the non-homogeneous differential equation.

First, find the complementary (homogeneous) solution. Consider the homogeneous equation:
[tex]\[ \frac{d^2 y}{dx^2} - 9y = 0. \][/tex]

Assume a solution of the form [tex]\(y = e^{rx}\)[/tex] and substitute it into the differential equation:
[tex]\[ r^2 e^{rx} - 9 e^{rx} = 0. \][/tex]
Factor out [tex]\(e^{rx}\)[/tex]:
[tex]\[ (r^2 - 9)e^{rx} = 0. \][/tex]

This gives us the characteristic equation:
[tex]\[ r^2 - 9 = 0, \][/tex]
[tex]\[ r^2 = 9, \][/tex]
[tex]\[ r = \pm 3. \][/tex]

So, the complementary (homogeneous) solution is:
[tex]\[ y_h = C_1 e^{3x} + C_2 e^{-3x}. \][/tex]

Next, find a particular solution to the non-homogeneous differential equation. We use the method of undetermined coefficients. Assume a particular solution of the form:
[tex]\[ y_p = A e^{5x}. \][/tex]

Substitute [tex]\(y_p\)[/tex] into the non-homogeneous differential equation:
[tex]\[ \frac{d^2}{dx^2} (Ae^{5x}) - 9(Ae^{5x}) = 7e^{5x}, \][/tex]
[tex]\[ 25Ae^{5x} - 9Ae^{5x} = 7e^{5x}, \][/tex]
[tex]\[ (25A - 9A)e^{5x} = 7e^{5x}, \][/tex]
[tex]\[ 16A e^{5x} = 7e^{5x}, \][/tex]
[tex]\[ A = \frac{7}{16}. \][/tex]

Thus, the particular solution is:
[tex]\[ y_p = \frac{7}{16} e^{5x}. \][/tex]

Now, combine the complementary solution and the particular solution:
[tex]\[ y = y_h + y_p, \][/tex]
[tex]\[ y = C_1 e^{3x} + C_2 e^{-3x} + \frac{7}{16} e^{5x}. \][/tex]

Use the initial conditions to find [tex]\(C_1\)[/tex] and [tex]\(C_2\)[/tex]. For [tex]\(y(0) = 2\)[/tex]:
[tex]\[ 2 = C_1 e^{0} + C_2 e^{0} + \frac{7}{16} e^{0}, \][/tex]
[tex]\[ 2 = C_1 + C_2 + \frac{7}{16}, \][/tex]
[tex]\[ C_1 + C_2 = 2 - \frac{7}{16}, \][/tex]
[tex]\[ C_1 + C_2 = \frac{32}{16} - \frac{7}{16}, \][/tex]
[tex]\[ C_1 + C_2 = \frac{25}{16}. \][/tex]

For [tex]\(\frac{dy}{dx}\bigg|_{x=0} = 3\)[/tex]:
[tex]\[ \frac{dy}{dx} = 3C_1 e^{3x} - 3C_2 e^{-3x} + \frac{35}{16} e^{5x}, \][/tex]
[tex]\[ \frac{dy}{dx}\bigg|_{x=0} = 3C_1 - 3C_2 + \frac{35}{16}, \][/tex]
[tex]\[ 3 = 3C_1 - 3C_2 + \frac{35}{16}, \][/tex]
[tex]\[ 3C_1 - 3C_2 = 3 - \frac{35}{16}, \][/tex]
[tex]\[ 3C_1 - 3C_2 = \frac{48}{16} - \frac{35}{16}, \][/tex]
[tex]\[ 3C_1 - 3C_2 = \frac{13}{16}. \][/tex]

Divide both equations by 3:
[tex]\[ C_1 - C_2 = \frac{13}{48}. \][/tex]

Now solve the system of linear equations:
[tex]\[ C_1 + C_2 = \frac{25}{16}, \][/tex]
[tex]\[ C_1 - C_2 = \frac{13}{48}. \][/tex]

Add the two equations:
[tex]\[ 2C_1 = \frac{25}{16} + \frac{13}{48}, \][/tex]
[tex]\[ 2C_1 = \frac{75}{48} + \frac{13}{48}, \][/tex]
[tex]\[ 2C_1 = \frac{88}{48}, \][/tex]
[tex]\[ C_1 = \frac{44}{48}, \][/tex]
[tex]\[ C_1 = \frac{11}{12}. \][/tex]

Subtract the second equation from the first:
[tex]\[ 2C_2 = \frac{25}{16} - \frac{13}{48}, \][/tex]
[tex]\[ 2C_2 = \frac{75}{48} - \frac{13}{48}, \][/tex]
[tex]\[ 2C_2 = \frac{62}{48}, \][/tex]
[tex]\[ C_2 = \frac{31}{48}. \][/tex]

So, the particular solution with initial conditions is:
[tex]\[ y = \frac{7}{16} e^{5x} + \frac{11}{12} e^{3x} + \frac{31}{48} e^{-3x}. \][/tex]

Therefore, the solution to part (b) is:
[tex]\[ y = \frac{7}{16}e^{5x} + \frac{11}{12}e^{3x} + \frac{31}{48}e^{-3x}. \][/tex]

### Final Answer

Our complete solutions are:
- Part (a): [tex]\( y(x) = C_1 x \)[/tex],
- Part (b): [tex]\( y(x) = \frac{7}{16}e^{5x} + \frac{11}{12}e^{3x} + \frac{31}{48}e^{-3x} \)[/tex].