Multivariable Derivatives and Equations
Transcript
Previously, we used derivatives with single variables to model how objects like cars move. Derivatives with multiple variables and differential equations are also fundamental to nature. A differential equation governs the weird shape of the periodic table. Here, we'll discuss derivatives for functions with multiple variables, including partial derivatives, total differentials, ordinary differential equations, and partial differential equations. And where they show up in places like quantum mechanics and diffusion.
Let's start easy. Well, relatively easy. partial derivatives of linear functions. Quick recap from our functions video. I developed a linear equation to describe using apples and oranges. The number of glasses of juice, J, is calculated from the number of oranges added, R, and the number of apples added, A. Now, I can plot this in three dimensions, and this function forms a plane, depending on how many oranges and apples I use. We learned on Ft. Trek.
If we set the number of apples to zero, you can plot it in two dimensions. If we set the number of oranges to zero, you can plot it in two dimensions. So, each variable in this multi -variable function can be studied in turn by setting the other variables to a constant value. In this case, we set the number of apples in the left plot to zero, and we set the number of oranges in the right plot to zero. That's how partial differentiation works too. We take derivatives of functions with respect to one variable at a time, while treating the other variable as constant. What does the notation look like?
The partial derivative of the function, j, with respect to r, is 0 .5. We call this a partial derivative because we are driving only the R part of the function. Here, we treat A as a constant and take the derivative with respect to the R variable. Since we're taking a partial derivative, we use the Dell or partial character instead of the D from ordinary differentiation. This tells the reader that there are other variables that could change the derivative of the function. You will also commonly see a subscript, which is A here. That just means that I treated A as a constant when I took the partial derivative of J with respect to R. If you followed my video on calculus, you'll not be surprised that the derivative 0 .5 is the same as the slope in front of the R variable.
The slope in this case just means that for every one orange I add, I get one additional 0 .5 glass of juice. Let's try the partial derivative of the other variable. The partial derivative with respect to A is 0 .25. In this case, we treat r as a constant and take the derivative with respect to the a variable. Again, we use the Dell character to indicate that we're taking a partial derivative. And just like before, the derivative 0 .25 is the same as the slope in front of the A variable.
The slope in this case just means that for every one apple I add, I get an additional 0 .25 glasses of juice. The total differential is measured by combining all partial derivatives. We just substitute the first partial derivative. Then substitute the second partial derivative. And we have our final total derivative. Basically, you take turns deriving with each variable and adding them together. Let's look at a lightly non -linear equation we use all the time in chemistry. I like this example not just because I'm a chemist, but because I can relate it to real -world phenomena. This is the ideal gas law. This equation was sorted out in the late 18th to early 19th century, and we, chemists and physicists, used it even before we understood atoms. In chemistry, we use a tomato all sorts of phenomena because it's so easy and because gases are usually much simpler to understand than
liquids and solids. It relates the pressure of the gas P and its volume in a vessel V with how much of the gas there is and the temperature of the gas T. If you haven't done chemistry before, the amount n is the number of moles of gas. What is more, you might ask. You can think of it as the chemist does in. Instead of 12, it's 6 .022 times 10 to the 23rd power. So a mole of gas has 6 .022 times 10 to the 23rd power gas particles, atoms or molecules. Why the weird big and special number? It's because the mass of elements, like hydrogen, which has a proton, is very small, about 1 .67 times 10 to the minus 24th power grams.
If you have a bowl of hydrogen atoms, it's weighed at about 1 gram. The mole is approximately the inverse of the mass of a proton or neutron. If you have carbon 12 atoms, which have 6 protons and 6 neutrons, a mole of a laser of 12 grams. A mole of nitrogen 14 atoms weighs about 14 grams. You get the idea. Anyway, let's look at this equation of pressure as a function of n v and t.
So, if you say double the amount of gas, you'll double the pressure in the vessel. or you could double the temperature of the gas. Or you could put the gas in half the volume. Let's look at a balloon filled with air. The pressure outside the balloon depends on how high you are from sea level. But we'll say it's one bar. The balloon is inflated with a pressure inside of 1 .2 bb. Now, we can use partial derivatives to understand the different reasons the balloon's pressure could increase, inflating it, or decrease, deflating it. One thing we could do is blow more air into the balloon. We add more gas or increase N and the balloon's internal pressure
increases. The light text of the balloon gets tighter. If you increase the pressure too much by blowing in too much gas, it pops. Or we could grasp the balloon between our hands to squeeze and compress it. As we make the volume of the balloon smaller, the pressure inside increases, and the latex of the balloon gets tighter. If you increase the pressure too much by squeezing the balloon, it pops. Or we could heat up the balloon. As we heat up the gas without burning the latex, the pressure inside increases. And the latex of the balloon gets tighter. If you increase the pressure too much by heating the balloon, it pops. So there are three different ways that we can change the pressure inside the balloon. And these are each described by the three terms in the total differential equation. The total differential equation tells us by how much the pressure increases or decreases based on these changes. Let's take the partial derivative with respect to each variable.
First, we derive with respect to the N variable. We are treating the other variables as constants. We use the power rule as before. We then substitute this partial derivative in the equation below. Notice that this term is positive and has a positive slope. When we increase the numbers of moles of gas by blowing in the balloon, the change in the number of moles dn is positive times a positive slope. As a result, the change in pressure, DP, is positive and the pressure increases.
Next, we derive with respect to the V variable. This one's a bit different because v is in the denominator, so it has an exponent of minus 1. We then substitute this partial derivative in the equation below. Notice that this term is negative and has a negative slope. So when we decrease the volume of the balloon by crunching it with our hands, we are making the change in volume, dv negative. The negative dv times a negative slope gives a positive number. So the change in pressure, dp, increases.
Finally, we derive with respect to the T variable. We then substitute this partial derivative in the equation below. Notice that this term is positive and has a positive slope. So when we increase the temperature of the balloon, we are making the change in temperature, DT positive. The positive dt times a positive slope gives a positive number. So the change in pressure, dp, is positive and the pressure increases. The total differential equation tells us the reasons that the pressure of the gas will change. I can change the pressure by changing the number of moles, the volume, or the temperature individually. I could change the number of moles and volume together, or the volume and temperature together.
Or I could change all three at the same time. In thermodynamics, we use special words to indicate these different changes. When we say a system is closed, we mean that the balloon knot is tied and we aren't blowing in or letting air out. In this case, dn is equal to zero. When we say a process is isochoric, we mean that the volume isn't changing. Maybe the balloon is encased in plaster. In this case, dv is equal to zero. When we say a process is isothermal, we mean that the temperature isn't changing.
And we're not heating or cooling the balloon. In this case, dT is equal to zero. You might have asked yourself at this point, what about R? R is the gas constant and by definition it is a constant. It doesn't change. So you could take its partial derivative, but in the equation below, dr would be equal to zero because it doesn't change. Again, it's a constant, not a variable. So, it doesn't factor into the total differential equation. At least, if you know the value with high certainty.
Slopes and the values of the derivatives change depending on what the values of N, V and T are. We can plot this equation, which we'll call PVT space. You may notice that N doesn't show up in this graph. We're making it constant and setting it to 100 millimoles. So this is a closed system. I .e. gas doesn't leave or come in. That's also why it doesn't show up in the total differential equation below. Dn, the change in the number of moles is equal to zero. It's basically a sealed piston that you can compress, expand, heat up or cool down.
Now, let's set up a piston of volume 1 liter in temperature of 298 Kelvin. That's 25 degrees Celsius or 70 degrees Fahrenheit. The pressure at this point is 2 .4776 bar. That's about two and a half times the atmospheric pressure. How much the pressure changes, Dp, for a given change in volume, Dv, or temperature, Dt, depends on our location in PVT space. You can think about it like the slope being steeper or flatter depending on where you are on the hell.
Here are the slopes evaluated from the partial derivatives at this point on the surface. A small increase in volume, dv, of 0 .001 liter, or 1 milliliter, will lead to a change in pressure of minus 2 .5 millibar. That means that our initial pressure of 2 .4776 bar would decrease to 2 .4751 bar. A small increase in temperature, DT of 0 .1 Kelvin, or 0 .1 degrees Celsius, will lead to a change in pressure of 0 .83 millibar. That means that our initial pressure of about 2 .4776 bar will increase very slightly to about 2 .4784 bar.
Let's look at another point. Maybe we compress the gas from one liter to 0 .5 liters, the gas is heated from 298 Kelvin to 310 Kelvin. Under these conditions, the gas has a pressure of 5 .15 bar, according to the ideal gas law. As you can see, the slopes in the total differential equation are different for these new conditions. A small increase in volume, dv, of 0 .001 liter, or 1 milliliter, will lead to a change in pressure of minus 10 .3 millibar.
A small increase in temperature, dt of 0 .1 Kelvin or 0 .1 degrees Celsius, will lead to a change in pressure of 1 .6 millibar. So the values of the derivative depend on where you are on the surface and PVT space. This brings up two new issues. The first is the magnitude of the derivative and its accuracy. I can calculate the change in pressure, delta P, using fairly large values for delta V and delta T. Since the slopes also change depending on V and T, the bigger the number I use for delta V and delta T, the less accurate delta P will be. Let's go back to our original point at v equals 1 liter and t equals 298 Kelvin.
The difference from this point to our second point has a delta V of minus 0 .5 liter and a delta T of plus 12 Kelvin. If we put these delta values in the equation, we get a delta P of plus 2 .34 bar. But we already know what the Delta P should be. The second pressure, 5 .15 bar, minus the initial pressure, 2 .48 bar is 2 .68 bar. The delta P from the differential equation is close, but it's off by about 12 % from the correct value.
After all, the total differential deals with DP, DV and DT, which are infinitesimally small changes in pressure, volume and temperature respectively. How would you fix this? By breaking up the changes from the first point to the second point into much smaller steps, maybe five or more steps. So instead of 1 liter to 0 .5 liter and 298 Kelvin to 310 Kelvin, we would calculate delta P for 1 liter to a 0 .9 liter and 298 Kelvin to 300 Kelvin. Then calculate a new delta P from 0 .9 liter to 0 .8 liter and 300 Kelvin to 303 Kelvin. And so on.
The second issue with the total differential equation is directionality. In the first video on calculus, we learned that the derivative gets the slope of the tangent line at one point of the function. That's true here too, but it's an arrow, a vector. The total differential equation gives us the magnitude of this vector, but we're losing the direction of this vector. The vector itself is called the gradient. The i hat and j hat are what we call component unit vectors. They tell us to move along the v dimension and t dimensioned respectively.
To use the gradient and other entities that take the cross product, the curl, we need to cover some linear algebra, which I'll cover in an upcoming video. So far, we've taken a known multi -variable function, like juice recipes or the ideal gas law, and calculated its partial derivatives to understand its slopes in different directions. In the physical sciences, however, we often face the exact opposite challenge. We don't know what the overall function looks like in advance. So, you can use single variable calculus to take the derivative of a function with one variable. Or you could use multi variable calculus to take partial derivatives of two or more variables of a function. There's also a 2 girls of both, which we haven't covered in this video. A new class of problems that arise frequently in the physical sciences are differential equations. An equation that relates unknown single variable function to its
derivatives is called an ordinary differential equation, or ODE. An equation that relates an unknown function of two or more variables to its partial derivatives is called a partial differential equation, or PDE. Unlike ordinary algebra where the solution is a single number, the solution of these is a function or functions. If you're just studying general physics, general chemistry and thermodynamics, then derivatives, simple integrals, and partial derivatives are usually good enough. If you're studying quantum mechanics, fixed law, electrodynamics and other topics, then ODEs and PDEs will come up often.
Let's start with one of the simplest and incidentally most useful models in physics. A weight like a ball on a spring. If you watched my video introducing calculus, you've already encountered the trajectory function in one dimension, X of T, when we are dealing with a car driving from Chicago to Milwaukee. We will use Hooke's Law and the harmonic oscillator to understand this trajectory function. That's a lot of words. If you haven't heard them before, we'll cover them step by step. First, as promised, a spring and a ball.
When the spring is elongated, it forces the ball back to the left, toward the center. When the spring is compressed, it forces the ball to the right toward the center. This force is described by Hooke's Law. In the middle, the deviation from the center, x is zero, so there's no force on the ball. When the spring is elongated, x is at its maximum and has a positive value. So the force is greatest and has a negative value, pushing the ball toward the center. When the spring is compressed, x is at its maximum and has a negative value. So the force is greatest and has a positive value, pushing the ball toward the center.
Now, we write x as a function of t because x, the deflection, changes with time. So we know it's a function with a variable of t. We just don't know what that function is yet. As it happens, we don't have all the equations we need to solve the problem. Additionally, we need Newton's second law, which relates force to acceleration. What is acceleration? It's how quickly the velocity changes for a given amount of time, or the time derivative of the velocity. What's the velocity? It's how quickly the ball changes position for a given amount of time, or the time derivative of the position. This also means that the acceleration is the derivative of the derivative of the position, or the second derivative of the position.
Now, let's put these together. The force from Hooke's Law on the left is equal to the force from Newton's second law on the right. We call this an ordinary differential equation, ODE, because it depends on one independent variable, T. The secret to this problem is to find which functions follow this equation. It's like a backward puzzle. As it turns out, mathematicians have been solving differential equations like this for centuries. This one's straightforward. An easy way to begin is to make educated guesses. Let's first do some algebra. So, we need a function that when we take the second derivative on the
right, we get the function back time some extra stuff. Note that the extra stuff minus k over m has a negative sign which is important. If you learn more about differential equations, you'll learn that this scaling constant, minus k over m in this instance, is called the eigenvalue. The function is an eigenfunction. We'll save that for another video. Let's look at some examples of different functions and their derivatives. Okay, so simple exponents don't work because the original function, t to the power of n, is not the same function as t to the power of n minus 2. For example, we could pick T to the third power, and a second derivative is 6T, which is not a cubic function. That's out. Now, exponentials seem to work. Remember, that's Euler's number to the power of A times T. I get the original function back, E to the A times T. However, the scaling constant in the front, a squared, has the wrong sign.
It's positive. This is true even if we had used an exponent of minus a times t as our original function. For now, since this value has the wrong sign, it won't work. That's out. As an aside, Euler's formula and complex numbers work here, but for now we'll keep it real. Pun intended? Now we have our solutions. If we use either a cosigner sign function and take the second derivative, we get the same function back and it's multiplied by a negative value which is what we need.
You're probably asking yourself, well, which one do we use then? The answer depends on how you start or frame the problem. If you start by pulling or pushing the spring to maximum deflection and letting go, you use cosine. If you start by tapping the ball at its equilibrium position, you use a sine function. This brings up an important point with differential equations. The solution is tied to the initial conditions of your problem. Like with coordinate transformations, you use experience to pick these to make the math easier.
Let's go back to our ordinary differential equation. Okay, let's substitute our solution into the differential equation. Here we skipped a couple of small steps. First, you may have noticed the amplitude L, which is in front of the cosine. It cancels out in this differential equation, but it guarantees that when the cosine reaches its maximum value, plus or minus 1, it's multiplied by the maximum distance traveled, L. Next, we had an A parameter, which is an angular frequency, in front of the T in the previous table. We changed it to the square root of k over m. Why? Because it guarantees that we get the factor in front, the minus k over m, which was minus a squared when we took the second derivative. And, altogether, we've determined our differential equation.
That's an ordinary differential equation. We worked backwards from a differential equation to find the function that solves it. Here, we show the function x of t on the top. It's derivative with time velocity, and it's second derivative with time acceleration on the bottom. Partial differential equations, PDEs, work the same way, but they have two or more variables. If you thought ODE's were hairy, PDEs are hairier. Different classes of PDEs have become fields of their own. I'd have a tough time doing anyone justice is a short part of this video. Instead, I'll give a sampler platter of PD examples and fields.
La Placés and Poisson's equations are PDEs that are the basis of many branches in physics and chemistry. First, it's common to take the first derivative with respect to each spatial variable. In our harmonic oscillator example in one dimension, we have a potential of V of X equals one half KX squared, and its derivative with respect to X is the force along the X axis. And more than one dimension, it's more convenient to write the derivative with respect to each spatial variable using an operator we call Nubla. The noblest symbol is an upside down delta.
Naubla comes from the Greek word for harp, which I guess fits. In Laplace's and Plessons equations, we apply this operator twice to take the second derivative of a function with respect to each spatial variable. Confusingly, in some contexts, physicists will often rate this operator nobler squared as delta. You might be asking yourself, well, why were I not using X sub one, X sub two, X sub three, and so on? Isn't it just x, y, and z? Yes and no. In another video, I'll talk about coordinate transformations.
These operators and their solutions are different for those. Now, an important class of problems that uses the second derivative is quantum mechanics. It's used to measure the kinetic energy of a wave particle like an electron. Now, since atoms are spherical instead of boxes, Nabla squared is usually expressed in spherical polar coordinates in this context, not Cartesian. The energy levels are described in terms of angular momentum states. Importantly, the PDE solution to the angular part of this problem are called spherical harmonics.
Spherical harmonics are the reason the periodic table has a shape that it does, which is pretty interesting. Well, interesting to me at least, but I don't get out too frequently. I won't talk at length about spherical harmonics at this time, but I'll point out that there are a bunch of them. For electron orbitals, there's an L number which can take values of 0, 1, 2, and 3. Then, there's the M number, which can take values from minus L to plus L in increments of 1. So when L equals zero and M equals zero, there is one spherical harmonic function. Since electrons can adopt two spin states, up or down, the number of orbital functions is doubled. So two functions.
When l equals 1, m can take values of minus 1, 0, and 1, which gives 6 functions, when you account for electron spins being either spin up or spin down. When L equals 2, M can take values of minus 2 minus 1, 0, 1, and 2, which gives 10 functions. When l equals 3, m can take values of minus 3, minus 2, minus 1, 0, 1, 2, and 3, which gives 14 functions. We draw the bottom two rows, which we call the F block separately. They belong with the other elements on the main table, but we present them like this so the table is easier to read.
Defusion, fixed law, mass transport and fluid dynamics is another area. Here, I have diffusion written in one dimension, but as you would expect, you could use the Naveless squared as well, for more spatial dimensions. We use these equations to describe problems like how quickly things dissolve in a solvent. For example, if you drop some blue ink in water, the blue color will spread out in the water over time. These equations describe this behavior. The PDA solutions for this type of problem are Gaussian functions.
Functions with more than one independent variable, whether you decide to include additional spatial variables like x, y, and z, time variables, t, or some other variables, use partial derivatives to evaluate the total derivative. In many problems, we may know the relationship of a function to its derivatives, but we don't know who the function itself. When these have only one independent variable, like x, we call these ordinary differential equations. When the function has more than one independent variable, like spatial variables x, y, and z, and a time variable t, we call these partial differential equations.
You might be thinking of the stage, wait, you completely skipped integrals of functions with multiple variables. Yes, I haven't covered them yet because they're the topic of an upcoming video. In this upcoming video, I'll not only cover integrals for multi -variable functions, but also coordinate transformations, which come up often in multi -variant calculus.

Ask anything
We've read this whole study set, so questions about it get the best answers.