# A line through a point with a function as slope

I need help with this calculus problem

Find the function $f$ whose tangent line has slope $(x+2)e^{−x}+2$ for each value of $x$ and whose graph passes through the point $(0,1).$

I really don't know how to go about solving this problem can anyone walk me through it?

• It means that you have this constraint $f'(x)=(x+2)e^{-x}+2$ with $f(0)=1$: you have to find a sol. to a differential equation... Hint : $f(x)$ has the form $(ax+b)e^{-x}+2x+c$, with unique constants $a$, $b$ and $c$. – Jean Marie Jun 19 '16 at 19:34

Hint:

The slope of the tangent line to a function is the derivative of the function. So you are asked to find a function $y=f(x)$ such that $y'=(x+2)e^{-x}+2$ and $f(0)=1$.

Here is an outline of what you need to do:

The function $f$ whose tangent line has slope $(x+2)e^{−x}+2$ means that $$f'(x)=(x+2)e^{−x}+2$$ To find $f(x)$, you need to find the antiderivative of $f'(x)$, which is of the form $F(x)=g(x)+C$

Now $f(x)=g(x)+C$ is the general form of all the antiderivatives of $f'$, but we are interested in the one that passes through $(0,1)$. Thus we need to find the $C$ value that satisfies $f(0)=1$. This is found by solving $f(0)=g(0)+C=1$ for $C$. Then after plugging in the $C$-value, then $f(x)=g(x)+C$ is the function you are asked to find.

As mentioned by JeanMarie, the solution to the problem must be of the form $(ax+b)e^{-x}+2x+c$.

So:

$$-(ax+b)e^{-x}+ae^{-x}+2=(x+2)e^{-x}+2$$ $$-axe^{-x}+(a-b)e^{-x}=xe^{-x}+2e^{-x}$$

Which means that $a=-1$ and $b=-3$. We now have the equation $-xe^{-x}-3e^{-x}+2x+c$. Since plugging in $0$ into this equation should give $1$, we get that $-3+c=1$. In other words, $c=4$. Our final answer is

$$-xe^{-x}-3e^{-x}+2x+4$$

Given: $$\frac{\mathrm{d} y}{\mathrm{d} x}=(x+2)e^{-x}+2 , f(0)=1$$ Solve Differential Equation: $${\mathrm{d} y}=((x+2)e^{-x}+2){\mathrm{d} x}$$ $$\int {\mathrm{d} y}=\int ((x+2)e^{-x}+2){\mathrm{d} x}$$ $$y=\int ((x+2)e^{-x}+2){\mathrm{d} x}$$ $$y=\int xe^{-x}{\mathrm{d} x}+\int 2e^{-x}{\mathrm{d} x}+\int 2{\mathrm{d} x}$$ $$y=-xe^{-x}-3e^{-x}+2x+C$$ Use Initial Condition to find Particular Solution: $$f(0)=1$$ $$y=-xe^{-x}-3e^{-x}+2x+C$$ $$1=0-1-2+0+C$$ $$C=4$$ $$y=-xe^{-x}-3e^{-x}+2x+4$$

• I think you mean $-xe^{-x}-3e^{-x}+2x+4$. – Hrhm Jun 19 '16 at 20:33
• Oops, Sorry. Wasn't paying attention. Thanks – Biggs Jun 19 '16 at 22:00