First order separable Equation ODE

Click For Summary
SUMMARY

The discussion centers on solving the first-order separable ordinary differential equation (ODE) given by \(\frac{dy}{dx} + y \cos x = 5 \cos x\) with the initial condition \(y(0) = 7\). Two potential solutions, \(y = 5 - 2e^{-\sin x}\) and \(y = 5 + 2e^{-\sin x}\), are derived, but only the first solution is deemed correct according to the online homework system. The participants clarify that the absolute value in the equation must be handled carefully, particularly when applying initial conditions to determine the correct solution.

PREREQUISITES
  • Understanding of first-order separable ordinary differential equations (ODEs)
  • Familiarity with integration techniques, particularly for separable equations
  • Knowledge of initial value problems and how to apply initial conditions
  • Basic understanding of exponential functions and their properties
NEXT STEPS
  • Review the method of solving first-order separable ODEs in detail
  • Study the application of initial conditions in differential equations
  • Learn about the implications of absolute values in mathematical expressions
  • Explore verification techniques for solutions of differential equations through differentiation
USEFUL FOR

Students studying differential equations, mathematics educators, and anyone involved in solving initial value problems in calculus.

sanhuy
Messages
40
Reaction score
2

Homework Statement


\frac{dy}{dx}\:+\:ycosx\:=\:5cosx
I get two solutions for y however only one of them is correct according to my online homework
(see attempt at solution)

Homework Equations


y(0) = 7 is initial condition

The Attempt at a Solution


\int \:\frac{1}{5-y}dy\:=\:\int \:cosxdx\:+\:C
-ln\left|5-7\right|\:=\:sinx\:+C
\left|5-y\right|\:=\:De^{-sinx}\:where\:D\:=\:e^{-C}
\left|5-y\right|\:=\:5-y\:,\:if\:5-y\:>\:0\:and\:\left|5-y\right|\:=\:-\left(5-y\right)\:if\:5-y<0
using initial conditions for both equations
y=5\:-De^{-sinx}\:\:and\:\:y\:=\:5+De^{-sinx}
y=5\:-2e^{-sinx}\:\:and\:\:y\:=\:5+2e^{-sinx}

however the first solution is incorrect I don't understand why
 
Last edited by a moderator:
Physics news on Phys.org
sanhuy said:

Homework Statement


\frac{dy}{dx}\:+\:ycosx\:=\:5cosx
I get two solutions for y however only one of them is correct according to my online homework
(see attempt at solution)

Homework Equations


y(0) = 7 is initial condition

The Attempt at a Solution


\int \:\frac{1}{5-y}dy\:=\:\int \:cosxdx\:+\:C
-ln\left|5-7\right|\:=\:sinx\:+C
Did you mean 5 - y above? If you really meant 5 -7, I wouldn't substitute in the initial condition yet.
sanhuy said:
\left|5-y\right|\:=\:De^{-sinx}\:where\:D\:=\:e^{-C}
\left|5-y\right|\:=\:5-y\:,\:if\:5-y\:>\:0\:and\:\left|5-y\right|\:=\:-\left(5-y\right)\:if\:5-y<0
using initial conditions for both equations
y=5\:-De^{-sinx}\:\:and\:\:y\:=\:5+De^{-sinx}
y=5\:-2e^{-sinx}\:\:and\:\:y\:=\:5+2e^{-sinx}

however the first solution is incorrect I don't understand why
I'm not totally clear on what you're doing above. Since y(0) = 7, you can assume that y -7 < 0 for solutions near the initial condition.
 
sanhuy said:

Homework Statement


\frac{dy}{dx}\:+\:ycosx\:=\:5cosx
I get two solutions for y however only one of them is correct according to my online homework
(see attempt at solution)

Homework Equations


y(0) = 7 is initial condition

The Attempt at a Solution


\int \:\frac{1}{5-y}dy\:=\:\int \:cosxdx\:+\:C
-ln\left|5-7\right|\:=\:sinx\:+C
\left|5-y\right|\:=\:De^{-sinx}\:where\:D\:=\:e^{-C}
\left|5-y\right|\:=\:5-y\:,\:if\:5-y\:&gt;\:0\:and\:\left|5-y\right|\:=\:-\left(5-y\right)\:if\:5-y&lt;0
using initial conditions for both equations
y=5\:-De^{-sinx}\:\:and\:\:y\:=\:5+De^{-sinx}[/B]
y=5\:-2e^{-sinx}\:\:and\:\:y\:=\:5+2e^{-sinx}

however the first solution is incorrect I don't understand why
Why don't you apply the initial condition on ##\left|5-y\right|\:=\:De^{-sinx}\,##? That gives ##\left|5-y\right|\:=\:2e^{-sinx} > 0##. Now check your signs again.
 
fresh_42 said:
Why don't you apply the initial condition on ##\left|5-y\right|\:=\:De^{-sinx}\,##? That gives ##\left|5-y\right|\:=\:2e^{-sinx} > 0##. Now check your signs again.
Since 2e^−sinx>0 you can drop the absolute sign correct?
then it becomes
y=5−2e^−sinx?
 
sanhuy said:
Since 2e^−sinx>0 you can drop the absolute sign correct?
then it becomes
y=5−2e^−sinx?
No you can't, because inside the absolute sign can still happen both possibilities. Just consider the cases ##y(x) > 5## and ##y(x) \leq 5##.

Edit: Sorry, I think I made a sign error myself.
 
fresh_42 said:
No you can't, because inside the absolute sign can still happen both possibilities. Just consider the cases ##y(x) > 5## and ##y(x) \leq 5##.
if y(x) > 5 then |y-5| = (y-5)
and if y(x) <= 5 we get |y-5| = -(y-5) ?
then we get two solutions that i posted above again? Am i missing something here
 
Now, that I've seen my sign error, I did what you should do as well with all of these kind of equations: check them by differentiation. (I think you were right in the first place.)
 
fresh_42 said:
Now, that I've seen my sign error, I did what you should do as well with all of these kind of equations: check them by differentiation. (I think you were right in the first place.)
both solutions work, but my webwork says the first one is wrong
 
Maybe you've had a typo in your other solution. Or some additional information is hidden somewhere in your text.
 
  • #10
sanhuy said:
both solutions work, but my webwork says the first one is wrong
They satisfy the differential equation, but I do not see how your negative multiplier solution satisfies the initial condition.
 
  • Like
Likes   Reactions: fresh_42
  • #11
haruspex said:
They satisfy the differential equation, but I do not see how your negative multiplier solution satisfies the initial condition.
I just noticed this as well. BTW I was just wondering the way I got rid of my absolute values was correct right, regardless of the general problem i stated?
 
  • #12
sanhuy said:
I just noticed this as well. BTW I was just wondering the way I got rid of my absolute values was correct right, regardless of the general problem i stated?
I was not quite sure what you did. I would substitute x=0, y=7 with still |y-5| to find D=2. Then you get y=5+/-2e-sin(x), then reuse the initial condition to rule out the -2 case.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
11
Views
2K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
9
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
7
Views
2K