<s>[INST] Solution to differential equation with boundary conditions While studying transport physics, I encountered a problem, where we have to solve
$r \frac{dT}{dr} = C_1$, so the solution is $$T = C_1 \ln(r) + C_2.$$
Now with the imposed boundary conditions $T(r=R_2)= T_2$ and $T(r=R_1)= T_1$, the solution should be as follows:
$$T\left(R_{1} \leq r \leq R_{2}\right)=T_{1}+\left(T_{2}-T_{1}\right) \frac{\ln \left(r / R_{1}\right)}{\ln \left(R_{2} / R_{1}\right)}$$
How do you obtain this answer? I've tried integrating from $R_1$ to $r$ and then from $r$ to $R_2$ but that didn't work fully
 [/INST] Given the general solution $$T = C_1 \ln(r) + C_2$$ and boundary conditions
\begin{align}
T(R_{1}) &= T_{1}\\
T(R_{2}) &=T_{2}
\end{align}
we can plug in the boundary conditions to get:
\begin{align}
T_{1} &= C_{1}\ln(R_{1}) + C_{2}\\
T_{2} &= C_{1}\ln(R_{2}) + C_{2}.
\end{align}
We now have a system of two equations with two unknowns, and there are several techniques we could use to solve it.  One such process would be to subtract $T_{1} - T_{2}$:
$$T_{1} - T_{2} = C_{1}\ln(R_{1}) - C_{1}\ln(R_{2}) \implies C_{1} = \frac{T_{1} - T_{2}}{\ln(R_{1}) - \ln(R_{2})} = \frac{T_{1} - T_{2}}{\ln(R_{1}/R_{2})}.$$  Then, we can write:
$$T_{1} = \frac{T_{1} - T_{2}}{\ln(R_{1}/R_{2})} \ln(R_{1}) + C_{2} \implies C_{2} = T_{1} -\frac{T_{1} - T_{2}}{\ln(R_{1}/R_{2})} \ln(R_{1}).$$  This gives us
\begin{align}
T &= C_{1}\ln(r) + C_{2}\\
&=\frac{T_{1} - T_{2}}{\ln(R_{1}/R_{2})}\ln(r) + T_{1} -\frac{T_{1} - T_{2}}{\ln(R_{1}/R_{2})} \ln(R_{1})\\
&=T_{1}+\frac{T_{1}-T_{2}}{\ln(R_{1}/R_{2})}\left(\ln(r) - \ln(R_{1})\right)\\
&=T_{1} + (T_{1} - T_{2})\frac{\ln(r/R_{1})}{\ln(R_{1}/R_{2})}\\
&=T_{1}+\left(T_{2}-T_{1}\right) \frac{\ln \left(r / R_{1}\right)}{\ln \left(R_{2} / R_{1}\right)}.
\end{align}
</s>