# Solving this ODE

1. Mar 3, 2008

### msimmons

$$\frac{dy}{dt}=t-y$$
Where y is a function of t.

Just... not quite sure how to do it.
Also, would the method change if it was e^-t instead of t? I don't see why it would, but if it does, that's what I'm actually working with.

Thanks for any help.

2. Mar 3, 2008

### HallsofIvy

First look at dy/dt= -y. That's easy to solve and gives the general solution to the associated "homogeneous equation".

Now, try something of the form y= At+ B, for constants A and B. Put that into the equation and try to find A and B that will make the equation true.

Finally, use the "linearity" property: the sum of the general solution to the associated homogeneous equation and any solution to the entire equation is the general solution to the entire equation.

Or, since this is a first order equation, look for an "integrating factor". Rewrite the equation as dy/dt+ y= t and look for a function v(t) such that vdy/dt+ vy is an "exact derivative. That is, such that vdy/dt+ vy= d(vy)/dt. Differentiating on the right, using the product rule, gives vdy/dt+ vy= vdy/dt+ (dv/dt)y. The first terms on both sides are the same so we must have vy= (dv/dt)y or dv/dt= v. A solution to that is v= et. Multiplying dy/dt+ y= t by et, we get etdy/dt+ ety= d(ety)/dt= tet. Integrate both sides of that (use integration by parts on the right).

Both methods will work perfectly well with e-t instead of t. Try y= Ae-t instead of At+ B and solve for A.

3. Mar 3, 2008

### msimmons

ugh, of course. (second method)
So trivial once you're reminded ^^
Thanks.

So from
$$\frac{dy}{dt}=\frac{e^{\frac{t}{a}}}{a} + \frac{y}{b}$$

we get

$$\frac{d(ye^\frac{t}{b})}{dt}=\frac{e^{\frac{t}{a}-\frac{t}{b}}}{a}$$

which gives the solution (assuming at t=0 y=0)
$$y = \frac{-abe^{\frac{t}{a} - \frac{2t}{b}}}{a(a-b)}$$

... Right? If anyone feels like wasting a bit of time

Edit: I'm awesome at canceling variables.

$$y = \frac{be^{\frac{t}{a} - \frac{2t}{b}}}{b-a}$$

Last edited: Mar 3, 2008
4. Mar 4, 2008

### coomast

msimmons, it is not so trivial. Use the first method mentioned by HallsofIvy. So consider the following:

$$\frac{dy}{dt}-\frac{y}{b}=0$$

This has the solution:

$$\frac{dy}{y}=\frac{dt}{b} \qquad \rightarrow \qquad y_h=A\cdot e^{t/b}$$

Now to obtain the solution to the entire equation:

$$\frac{dy}{dt}-\frac{y}{b}=\frac{e^{t/a}}{a}$$

you need to distinguish between two cases, i.e. whether a and b are different or not. The first case, a not equal to b, you should set:

$$y_p=\alpha e^{t/a}$$

putting this into the differential equation gives now:

$$\alpha=\frac{b}{b-a}$$

and thus:

$$y_p=\frac{b}{b-a} e^{t/a}$$

The complete solution is now:

$$y=A\cdot e^{t/b}+\frac{b}{b-a} e^{t/a}$$

which makes it clear why they should be different... The other case can be solved by setting:

$$y_p=\alpha t e^{t/a}$$

Giving you:

$$\alpha=\frac{1}{a}$$

and thus:

$$y_p=\frac{t}{a} e^{t/a}$$

and for the complete solution:

$$y=\left(A+\frac{t}{a}\right) e^{t/a}$$

Applying the boundary condition is something you can do now by yourself. Look back into your book for these different cases, it's an important issue. Finally do the calculations again by yourself, don't use them just like that.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9107084274291992, "perplexity": 1294.569310232494}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-09/segments/1550247526282.78/warc/CC-MAIN-20190222200334-20190222222334-00135.warc.gz"}