# Which way of solving this differential equation is right?

For my homework assignment I need to solve the following differential equation:

$$\dfrac{dT}{dt} = -p(T - T_k)$$,

where $$T$$ stands for the temperature of the pizza, $$t$$ stands for time and $$T_k$$ stands for the temperature of the kitchen. They gave me the following information:

1. The initial temperature of the pizza coming out of the freezer at 8pm is $$-18^\circ$$C.

2. The temperature of the kitchen is $$20^\circ$$C.

3. $$p>0$$

First I tried solving the differential equation by substituting $$y$$ for $$T-T_k$$ and this gave me the following answer:

$$T = T_k + (T(0) - T_k)e^{-pt}$$, where I can of course plug in the values of $$T(0)$$ and $$T_k$$.

But then I tried solving the differential equation by applying integration from the start, and this gave me the following answer:

$$T = ce^{-pt} + T_k$$, where I solved $$c$$ by plugging in $$T(0) = -18$$ and this gave me a value of $$-38$$ for $$c$$.

After this I had to calculate the value of $$p$$, and I found $$p=\log(38) - \log(29)$$. For this question it doesn't matter what method I use because they will both give me the same answer $$T = T_k - 38 e^{-pt}$$, but in the following question they asked me to calculate the temperature of the kitchen in order to defrost the pizza by 9pm. This is where I get confused. When I use my first answer to the differential equation ($$T = T_k + (T(0) - T_k)e^{-pt})$$ I find a $$T_k$$ value of $$58^\circ$$C and when I use my second answer to the differential equation ($$T = T_k -38e^{-pt}$$) I find a $$T_k$$ value of $$29^\circ$$C. Which one (or maybe neither of them) is right and why? What am I doing wrong by solving the differential equation?

Both solutions to the differential equations are correct and should provide the same results. It is obvious that the kitchen temperature of $$29 c$$ is not realistic so redo the problem with your second formula and get the same result as you have from the first method

Notice that "$$-38$$" contains/hides an instance of $$T_k$$. If you hide that instance, you can't actually solve for $$T_k$$. To solve for $$T_k$$, you need to start with the form that shows all the $$T_k$$s that are present. Another way of saying this:

"$$T = T_k + (T(0) - T_k)\mathrm{e}^{-pt}$$" is the generic equation. It applies for any choice of $$T(0)$$ and $$T_k$$. When you solved for $$c$$, you actually solved for "$$c$$, dependent on $$T(0)$$ and $$T_k$$". If you change either $$T(0)$$ or $$T_k$$, you get a different $$c$$. That is, particular constants in solutions depend on the parameters present in the equation, so changing the parameters changes the constants (in general -- a careful choice of parameter change would leave $$c$$ unchanged).

So either use the generic equation, or remember to update your $$c$$ when you change the parameters.

• That makes sense, so my first solution to the differential equation was right because I didn't hide an instance of $T_k$ in that solution? – Neri Oct 12 '19 at 19:38
• Both solutions are right -- they're actually the same. One solution makes it easier to change the parameters, so it is more helpful in the next step of the problem. – Eric Towers Oct 12 '19 at 19:39
• But could I also use the second solution to calculate the $T_k$ in order to defrost the pizza by 9pm? Because I would need to find a $c$ for the solution to the differential equation, and I can't use the same $c$ as before. – Neri Oct 12 '19 at 19:42
• @Neri : Notice that when you find $c$, you solve $T(0) = c \cdot 1 + T_k$ for $c$. We can do this "once and for all": $c = T(0) - T_k$. Then, if someone changes the parameters $T(0)$ or $T_k$, we can immediately update $c$. Alternatively, if someone wants to leave $T(0)$ or $T_k$ unspecified, we can replace $c$ with its form in the parameters, $T(0) - T_k$, and proceed with the parameters visible, instead of hiding in $c$. – Eric Towers Oct 12 '19 at 19:46
• Thanks! I understand better now. The only thing I am confused about, what answer do they want when they ask for the solution of the differential equation? I know both answers are the same, but which one is more common to give as an answer to the differential equation? – Neri Oct 12 '19 at 20:02