Thumbnail for Understanding Calculus (for engineers) by The Efficient Engineer

Understanding Calculus (for engineers)

The Efficient Engineer

34m 2s4,730 words~24 min read
Auto-Generated

[0:00]Calculus is a fundamental tool in engineering. It helps us stabilize drones in flight. Predict how structures deform under loading and model the dynamics of vibrating systems. In all of these cases, we're asking the same fundamental question. How does the system respond when something changes? Calculus is how we answer that question. It's the mathematical study of change. In this video, we'll explore the key principles of calculus and discover exactly how they apply to real-world engineering problems. The easiest way to understand how one quantity is affected by changes to another is by plotting both on a graph. The slope of the graph, represented by a tangent line that just touches the curve, is a key piece of information. It tells us how sensitive one quantity is to another, and that sensitivity changes depending on where we are on the curve. The slope often has a real physical meaning. If the graph shows displacement on the horizontal axis and force on the vertical axis, the slope represents the stiffness of the object, like the stiffness of a spring, for example. If the graph shows velocity versus time, the slope is acceleration, and if it shows voltage versus current, the slope is electrical resistance. To understand how to extract this slope information in a systematic way, let's look at a simple example: the function Y = X³. Say we want to calculate the slope of this curve at a particular point. One way to approximate it is to pick another point slightly to the right, at X plus a small amount that we'll call delta X. The straight line between these two points gives us an estimate of the gradient of the curve at this position. It has a slope equal to the change in Y divided by the change in X. Now, imagine moving the two points closer together, shrinking delta X towards zero. As the points get closer, the line connecting them becomes a better and better approximation of the tangent at the point. And as delta X tends towards zero, the line between the two points becomes the true tangent, giving us the exact slope at that point. By expanding the slope equation and taking the limit as delta X tends towards zero, we obtain an equation that gives us the slope of our X³ function at any point X.

[2:41]As expected, this slope function has a value of zero at X equals zero, where the X³ curve is flat, and it increases as we move to the left or the right, where the slope of the X³ curve becomes steeper. What we've just done, figuring out the equation that gives us the slope of the function Y = X³ is called finding the derivative of the function. The derivative is written as dy over dx. It represents the change in Y per change in X. It can also be written as f prime of X or Y prime. In this function, X is the independent variable, the input we can choose, and Y is the dependent variable, the output that depends on our choice of X. We can use any variable names here. The independent variable is often T, for example, in which case dy over dt represents how quickly the quantity Y changes with time. When the independent variable is time, the dot notation is often used to represent derivatives. The approach we just used, starting with a line between two points on the curve and taking the limit as delta X approaches zero, is a process called differentiating from first principles. It's the underlying basis of differential calculus. But in practice, engineers rarely do this from scratch. We just saw that the derivative of X³ is 3x². This pattern isn't unique to that one function. It works for any function of the form X to the power of N. The derivative is obtained by multiplying by the power and reducing that power by one. Instead of deriving everything from scratch, engineers use tables of standard derivatives for the functions we see again and again, like sine, cosine, exponential functions, or square root functions. Let's look at a few examples. The derivative of a constant value is zero because it has no slope. And a straight line has a constant slope, so its derivative is a constant value. Sine and cosine functions appear all the time in engineering, especially in systems that vary cyclically with time, like alternating current circuits. This graph shows sine of X. At the peaks, where the function reaches a maximum, the slope is zero. And where the curve crosses the horizontal axis, the slope is at its steepest, corresponding to either its minimum or maximum value. The derivative of sine of X is cosine of X. Similarly, the derivative of cosine of X is negative sine of X. The negative is needed for the slope to have the correct sign, positive where cosine is rising, and negative where it's falling. Another important function is the exponential function. What makes it remarkable is that, at every point, the slope is exactly equal to the value of the function itself. The larger the value, the faster it grows. Exponential behavior shows up whenever the rate of change of a quantity depends on how much of that quantity already exists. Like the charge building up in a capacitor, or radioactive decay, where more atoms means more decay events. In most engineering applications, we're not dealing with a single, simple function, but a combination of more complicated functions. Fortunately, a few straightforward rules save us from having to differentiate from first principles every time. The first is the linearity rule. When two functions are added together, the derivative of the whole function is just the sum of the derivatives of the two individual functions. This doesn't work when the functions are multiplied together, though, because when both functions are changing, their rates of change interact. In these cases, the product rule needs to be used. The derivative of the product of two functions u and v is the derivative of u multiplied by v plus u multiplied by the derivative of v. Similarly, the quotient rule should be used when one function is divided by another. And finally, there's the chain rule. To find the derivative when one function is nested inside another, you differentiate the outer function, as if the inner part were just a single variable, and multiply it by the derivative of the inner function. Here's an example, where the inner function U is 3x, and the outer function V is sine of U. The derivative of this function is equal to the derivative of V with respect to U, which is cosine of U, multiplied by the derivative of U. Having 3x inside the sine term instead of just X means that as X increases, the input to the sine curve increases three times faster. This makes the slope of the curve three times steeper at every point, which is why you need to multiply by the derivative of U to get the correct slope.

[8:16]With these four simple rules and the table of derivatives for common functions, you can differentiate a huge range of complicated functions relatively easily.

[8:33]The derivative gives us a really useful tool for exploring the behavior of a function. If we plot this function on a graph, for example, you'll notice that wherever the derivative is zero, the function is at a local minimum or maximum. This happens because the slope of the curve goes from being negative to being positive at a minimum, and from being positive to negative at a maximum. In both cases, the slope must pass through zero at the turning point. This is a powerful application of calculus. If we want to find the maximum or minimum values of a function, we can just take its derivative and find where it's equal to zero. These points where the slope of a curve becomes flat are called stationary points. To figure out if a stationary point is a maximum or a minimum, all we need to do is look at how the slope itself changes around that point. And we can do that by taking the derivative of the derivative, which is called the second derivative. The second derivative tells us about the curvature of the function. If it's positive, the derivative has a positive slope, so the curve is bending upwards, which means we're at a local minimum. And if it's negative, the derivative has a negative slope, so the curve bends downwards, and we're at a local maximum. There's a third type of stationary point called an inflection point, where the curve doesn't turn back on itself, but its curvature reverses. At a stationary inflection point, both the first and second derivatives are zero, and the second derivative changes sign to reflect the curvature reversal. Now, let's see why this matters in the real world. Imagine a function that represents the temperature along a nuclear fuel rod. We want to model how this temperature distribution changes over time. This can be done using the heat equation. It tells us that the rate at which temperature changes over time depends on a material property called thermal diffusivity and how temperature is distributed along the rod, represented by the second derivative of temperature with respect to the position X. The second derivative appears in the equation because heat will flow away from local hot spots, where the second derivative is negative, toward cooler regions where the second derivative is positive.

[11:10]Many physical processes follow similar laws, where quantities spread over time from regions of high to low concentration. Fick's second law of diffusion, for example, is used to model the movement of atoms in a solid or the dispersion of contaminants in a liquid. In all such cases, calculus provides the framework for modeling how these quantities change over time.

[11:37]You might have noticed that these equations use a slightly different notation for the derivative. So far, we've only discussed derivatives of functions that depend on one variable, like time or position. But many real-world quantities depend on two variables or more. The curly D symbol tells us we're taking a partial derivative, which means we're looking at how temperature changes with respect to one variable, while holding the other constant. The partial derivative of temperature with respect to time describes how the temperature at any fixed point on the rod changes with time. In the partial derivative with respect to position describes how temperature varies along the length of the rod at a single instant in time. Take a simple function that depends on variables X and T. To take the partial derivative with respect to X, we differentiate by considering T to be a constant.

[12:35]And to take the partial derivative with respect to T, we consider X to be a constant.

[12:47]Differentiation takes a function and gives you the rate of change as you move along it. In some cases, though, the rate of change is what we already know, and we want to figure out the function itself. Imagine a function that tells you how some quantity changes with time. A power consumption curve for an electric motor, for example. It shows higher power consumption during startup, and lower consumption during steady operation. Power is the rate at which energy is consumed, measured in joules per second, so this curve effectively represents the derivative of the total energy consumption with respect to time. To figure out the total energy consumed over a set time period, we need to add up all of the small instantaneous changes. This process, accumulating all these infinitesimal changes to find the total quantity, is called integration. It's the reverse of differentiation. Graphically, integration corresponds to finding the area under a curve.

[13:50]To see why this is, imagine dividing the region under the curve into loads of thin vertical rectangles. Each rectangle has a width that corresponds to a small change in X, and a height equal to the value of the curve at that X. And so the rectangle approximates a tiny contribution to the total. 1,300 Joules per second consumed over 0.1 seconds is 130 Joules. To obtain the total accumulated quantity up to a certain point, you just add up all of the tiny contributions up to that point.

[14:26]As you make the rectangles thinner and thinner, you get closer to the exact area under the curve. Mathematically, integration is represented using the integral symbol. This means integrate the function F with respect to X. The result is a new function, the anti-derivative, that gives you the total amount accumulated as a function of X. When limits are added to the integral symbol, they define the interval over which you're integrating, which is equivalent to calculating the total accumulated change from X equals A to X equals B.

[15:05]Because integration is the reverse of differentiation, we can use the same lookup tables to integrate a function. To integrate X to the power of 4, for example, we add one to the power, giving us X to the power of 5. We also need to divide by the new power. Otherwise, we would end up with 5 times X to the power of 4 when differentiating. One important thing to realize is that information is lost when differentiating, because any constant terms have a slope of zero. These two functions are parallel curves with identical slopes at every point, just shifted up and down, so they differentiate to the same thing, X to the power of 4.

[15:52]For this reason, when integrating, an additional term, the constant of integration, needs to be added to account for any constant that might have been lost. If we know the value of the original function at a particular point, we can use that to find the value of C. And with the anti-derivative now defined, we can calculate the integral between two limits by taking its value at the upper limit and subtracting its value at the lower limit. You don't actually need to know the constant of integration when calculating an integral between two limits, because it cancels out when taking the difference between the upper and lower limits. Like differentiation, integration has certain rules that help when integrating more complicated functions. One of the most useful is called integration by parts, which helps integrate the product of two functions. It's the reverse of the product rule for differentiation. Say you want to integrate X times cosine of X. You split the function into two parts, U and V, and choose one part to differentiate and the other to integrate. By using the integration by parts formula to rewrite the integral, you end up with something that's much easier to solve.

[17:20]This method works really well if one part of the function is easy to differentiate and the other is easy to integrate. Another important technique is integration by substitution. It's used when the integral can be written in a form that includes an outer function, an inner function, and the derivative of that inner function. A simplified form of the integral could be obtained by substituting the inner function for a new variable, U.

[17:55]This can easily be integrated with respect to U, and substituting the expression for U back in gives the final answer in terms of the original variable, X.

[18:09]Integration by substitution is essentially just the reverse of the chain rule.

[18:18]In the real world, the behavior of an engineering system is rarely governed by a single neat function. More often, it depends on how certain parameters change with respect to others, and so these systems tend to be governed by differential equations, equations that define the relationship between a quantity and its derivatives. Equations like these appear everywhere in the physical world. Take a cable suspended between two points under its own weight. The shape the cable settles into is governed by a differential equation, derived by considering the balance of the forces acting on it. The equation depends on the first and second derivatives of Y, where X and Y represent the horizontal and vertical positions of the cable, as well as on the cable's weight per unit length and the tension within it. Solving the differential equation gives you the very specific shape adopted by the cable, which is called a catenary. Another example is the deflected shape of a beam. When a load is applied, the beam deforms in a way that satisfies a differential equation. The second derivative of the vertical deflection, Y, with respect to the distance along the beam, X, represents the curvature of the beam. At any point along the beam, this curvature depends on the bending moment at that location, produced by the applied load, and on two parameters that describe the beam's stiffness. The Young's modulus E, a measure of the material's stiffness, and the second moment of area I, which reflects how the beam's cross-section resists bending. Mechanical and civil engineers use this differential equation all the time to design and analyze structures.

[20:09]Differential equations often appear in vibration problems. The vibrational behavior of mechanical systems is often represented by a simple model, consisting of a mass connected to a spring and a damper. The model captures how real structures or components oscillate in response to disturbances. The vertical position of the mass X with respect to time depends on the forces acting on the mass, and the balance of these forces is governed by a differential equation. Each term in the equation corresponds to a physical effect. The inertial force is proportional to acceleration. The damping force is proportional to velocity, and the spring restoring force is proportional to position. Electrical systems can also be described using differential equations. Take an RLC circuit, which contains a resistor, an inductor, and a capacitor connected in series. Because the inductor and capacitor store energy, the current doesn't respond instantly when voltage is applied. Instead, the charge Q builds up or discharges over time in a way that's governed by a differential equation. Each term on the left side of the equation represents the voltage drop across one of the components, and the term on the right side represents the applied voltage.

[21:37]As you can see, differential equations appear everywhere in engineering and take many different forms. To analyze them effectively, we need to understand the different types of equations and how they're classified. If the equation involves the first derivative of a function, it's a first order differential equation. If it includes second derivatives, it's second order. Third-order differential equations contain third derivatives, and so on. If the equation contains derivatives with respect to just one independent variable, it's called an ordinary differential equation. If it has two or more, like the heat equation we saw earlier, it's a partial differential equation. An equation is non-linear if the dependent variable or its derivatives are raised to a power, multiplied by each other, or appear inside non-linear functions, like sign or exponential functions. It's non-homogeneous if there's a term that doesn't include the variable or its derivatives, meaning the whole equation would be non-zero if the dependent variable was set to zero. And it's autonomous if the independent variable doesn't appear in the equation, and no terms depend on it. In systems defined by autonomous equations, the evolution of the system only depends on the current state of the system, not on the independent variable itself.

[23:08]These categories aren't mutually exclusive. Here's an example of a second order, ordinary, non-linear, non-homogeneous, non-autonomous differential equation. The damped vibration equation we saw earlier is a second-order, ordinary, linear, homogeneous, autonomous differential equation. It's homogeneous because every term in the equation involves the displacement X or its derivatives. Physically, this means the equation describes the system's natural response, how the mass oscillates and eventually comes to rest without any external force acting on it. If a time-dependent external force is applied to the mass, producing forced vibration, the system is no longer self-determined. It's driven by the applied force. The resulting equation is non-homogeneous because it includes an external forcing term. It's also non-autonomous because the independent variable, time, now appears in the equation. Solving a differential equation is the process of finding the unknown function that satisfies the equation and meets any boundary or initial conditions. It's a huge topic, so for this video, let's just touch on a few common solution methods.

[24:29]Direct integration is used when a derivative of any order appears by itself on one side of the equation, and the other side depends only on the independent variable. This is the case for the beam equation, because the second-order derivative is on the left side of the equation, and the terms on the right are either constants or known quantities that depend on X. In other words, the equation only contains one derivative term, and the unknown variable Y doesn't appear separately. To solve the equation, all we need to do is integrate until we obtain Y. For the beam equation, that means integrating twice. For this example, E and I are constants, and the bending moment is equal to minus P times X. Each integration reduces the order by one and introduces a constant of integration.

[25:28]The constants can be found by applying the boundary conditions. This gives us the deflected shape of the beam.

[25:41]The separation of variables method is a bit more versatile. It's usually applied to first-order equations that contain both the dependent and independent variables. The idea is to rearrange the equation so that all terms involving the dependent variable, including its differential, dy in this case, are on one side. And all terms involving the independent variable, and its differential dx, are on the other. Once separated, both sides can be integrated independently, and the equation can be rearranged or simplified to obtain the solution. Here's a quick example, where the derivative dy over dx is equal to x² times y. Separating the variables and integrating both sides gives an equation for Y.

[26:40]There are loads of other techniques for solving differential equations, too many to cover here. Like the integrating factor method, complementary and particular solutions, the Laplace transform approach, and more. Even so, many real-world equations can't be solved, either the math becomes far too complex, or an analytical solution just doesn't exist. This is often the case for non-linear equations. A well-known example is the Navier-Stokes equations, which describe the motion of fluid. This system of partial non-linear differential equations has no analytical solution. Part of the reason it's so difficult to solve is the non-linear part of the inertial term, where the fluid's velocity at a point depends on how the velocity varies spatially around that point. For equations like this one that are difficult or impossible to solve, engineers use numerical methods, methods that find approximate solutions by iteratively calculating the value of a function in small steps. The entire field of computational fluid dynamics is based on applying approximate numerical methods and a lot of computing power to the Navier-Stokes equations to simulate fluid flow. One of the simplest numerical methods is Euler's method. Say you're working with a differential equation that describes how a cell population in a bioreactor grows over time. The rate at which the population grows depends on its current size, how near it is to the maximum population the environment can sustain, and on a growth rate constant. If you can't solve the equation directly to find the population size as a function of time, you can estimate it using Euler's method instead. You start from an initial value, in this case, a population size of one at time zero. By repeatedly calculating the slope of the curve from the differential equation, multiplying that slope by a chosen time step, and adding the result to the previous value, you can gradually trace out an approximate solution to the equation.

[29:06]The smaller the step size you use, the closer this approximation becomes to the exact solution. More advanced numerical techniques, like the Runge-Kutta method, can get you even closer to the exact solution. One really important engineering application of calculus is in control systems. Systems that manage the behavior of a machine or device, using feedback and sensor data to achieve a desired outcome. Say you want to design a system that can maneuver and stabilize a quadcopter. First, you need to understand the physics that govern its motion. Let's focus on adjusting the pitch angle, which tilts the drone forwards and backwards. This is done by changing the relative thrust of the front and rear motor pairs. If the rear motors spin slightly faster than the front ones, they generate more upward thrust, producing a torque that causes the drone to pitch forwards. The relationship between the torque and the resulting pitch angle is described by a differential equation. The second derivative of the pitch angle with respect to time, which is angular acceleration, depends on the applied torque and the drone's mass moment of inertia about the pitch axis. This equation provides the foundation for simulating the drone's motion. By integrating it twice with respect to time, we can calculate how the pitch angle changes as the motor speeds and so the torque are adjusted. Similar equations can be derived for the roll and yaw axes as well. These equations form part of the mathematical model of the drone. A model engineers use during the design phase to simulate its behavior and fine-tune the control system parameters.

[31:00]In flight, the onboard flight controller uses sensor feedback to track how the drone is moving and makes adjustments through a feedback loop, implemented by an algorithm called a PID controller. The controller continuously calculates the error between where the drone is and where it should be, and adjusts the motor speeds to reduce the error. Here again, calculus plays a key role. The PID controller has three parts. The proportional term reacts to the current error. A large error produces a stronger correction. The integral term takes the integral of the error over time, increasing the correction whenever an error persists to eliminate steady drift. And the derivative term takes the derivative of the error with respect to time, responding to how quickly the error is changing to dampen oscillations and avoid overshoot. Without calculus and differential equations, it would be impossible to simulate a drone's behavior or design a controller capable of keeping it stable in flight.

[32:06]We've covered a lot of ground in this video. But if you want to take it a step further, I highly recommend you check out this video's sponsor, Brilliant. Download their app and work through their course on calculus. It's the perfect companion to this video and will help you cement your understanding of the concepts we've been exploring, not by watching, but by doing. Brilliant is a learning app, built around active problem-solving. Instead of taking in information passively, you dive into fun interactive lessons that challenge you to think about new concepts and test your understanding as you go. This hands-on approach is incredibly effective because you're building intuition and understanding through practice. Beyond calculus, Brilliant has a huge range of courses covering science, logic, programming, data analysis, and even how AI works, all designed to help you develop strong analytical and problem-solving skills. Each course is split into bite-sized, interactive lessons you can work through at your own pace, with visual explanations, guided problems, and instant feedback that will keep you engaged as you learn. All engineers need to know how to problem-solve effectively, but it's not really something you can learn from a textbook or a video. It's a skill that's developed by tackling problems, making mistakes, and building intuition over time, and that is exactly what Brilliant is designed for. To get started for free, go to brilliant.org/EfficientEngineer. Click the link in the description or scan the QR code. And if you decide to sign up for the annual Premium subscription for unlimited daily access to everything on Brilliant, the link will give you a 20% discount.

[33:58]And that's it for this look at calculus. Thanks for watching.

Need another transcript?

Paste any YouTube URL to get a clean transcript in seconds.

Get a Transcript