I am trying to teach myself about the basics of the heat/diffusion equation - specifically, trying to understand the logic/motivation as to how they were able to come up with this. Here is my attempt to understand what is being implied by the heat/diffusion equation
$$\text{Diffusion Equation:} \quad\frac{{d}}{{dt}} U(x,t) = k^2 \frac{{d^2}}{{d^2x}} U(x,t)$$
The Left Hand Side of the diffusion equation can be written as follows (finite differentiation approximation) :
$$\frac{{d}}{{dt}} U(x,t) = \frac{{U(x, t + \Delta t) - U(x,t)}}{{\Delta t}}\tag{1}\label{}$$
The Right Hand Side of the diffusion equation can be written in two parts as follows (Taylor Approximation):
$$U(x + \Delta x, t) = U(x,t) + \Delta x \frac{{d}}{{dx}} U(x,t) + \frac{{\Delta x^2}}{2} \frac{{d^2}}{{d^2x}} U(x,t)\tag{2}\label{}$$ $$U(x - \Delta x, t) = U(x,t) - \Delta x \frac{{d}}{{dx}} U(x,t) + \frac{{\Delta x^2}}{2} \frac{{d^2}}{{d^2x}} U(x,t)\tag{3}\label{}$$
Now, if we add (2) and (3), we get:
$$\frac{{d^2}}{{dx^2}} U(x,t) = \frac{{U(x + \Delta x, t) + U(x - \Delta x, t) - 2U(x,t)}}{{\Delta x^2}}\tag{4}\label{}$$
Now, we can update the original diffusion equation using (1) and (4) and obtain:
$$\frac{{U(x, t+\Delta t) - U(x,t)}}{{\Delta t}} = K^2 [\frac{{U(x + \Delta x, t) + U(x - \Delta x, t) - 2U(x,t)}}{{\Delta x^2}}] \tag{5}\label{}$$
Now, here is my interpretation of (5):
Case 1: For equation (5), if the Right Hand Side is positive, the Left Hand Side must also be positive since they are equal. If the Right Hand Side is positive, at time = t, the immediate neighbors of position x have more particles than position x itself. Now, let's look at the Left Hand Side : If the Right Hand Side is positive, it suggests that in some short time $\Delta t$, position x will have more particles after time $\Delta t$ has elapsed compared to before when time $\Delta t$ had elapsed (i.e. net change is positive).
Case 2: For equation (5), if the Right Hand Side is negative, the Left Hand Side must also be negative since they are equal. If the Right Hand Side is negative, at time = t, the immediate neighbors of position x have fewer particles than position x itself. Now, let's look at the Left Hand Side : If the Right Hand Side is negative, it suggests that in some short time $\Delta t$, position x will have more fewer after time $\Delta t$ has elapsed compared to before when time $\Delta t$ had elapsed (i.e. net change is negative).
Thus, the diffusion equation captures the following idea: When some point x has more particles than its neighbors, x will send some of its particles to its neighbors. And when this same point x has fewer particles than its neighbors, the neighbors will send some of their particles towards point x.
My Question: Is my interpretation the same motivation that was used to develop the diffusion equation? For example, after observing how heat and particles naturally travel through different mediums until they achieve equilibrium (i.e. steady state) - did scientists set out to figure out a general equation that implicitly captured movements over time between higher density points to lower density points? How did exactly did scientists know that an equation of the form $\frac{{d}}{{dt}} U(x,t) = k^2 \frac{{d^2}}{{d^2x}} U(x,t)$ could be used to capture this natural behavior? Was it trial and error (e.g. write a candidate differential equation and see if this equation was a good candidate to describe movement over time, else restart) ... or was this just an extremely obvious and logical fact that was known at the time about differential equations?
Thanks!