[music] This is a story about three bubbles. Well it's really about three bubble walls, alright? I imagine that I've got this pane of glass here, alright? And I've got three points connected by three edges of bubble. So, where do these bits of bubble end up intersecting? This actually turns out to be an optimization problem. Bubbles wants to be as small as possible. So, less colorfully, this is what I'm really asking for. I imagine that I've got a triangle, and I'm trying to find a point in the middle of the triangle so that the sum of these three lengths, a plus b plus c, is as small as possible. Try to minimize the total length of bubble. Let's make this concrete. Let's actually pick points and place the triangle at those point. Anyhow, we should be drawing a picture, right? We should be starting by drawing a picture. So, for concreteness, I'm going to put the 3 vertices here at 0,1, 0,0, and 1,0. And then, what am I trying to do, well, I'm trying to find a point, I call it x,y, in the in the middle of the triangle so that these lengths this length here, which I'm calling a, the length from x,y to the origin, I call b, and the length from x,y to the point 1,0, which I'll call c. I want a plus b plus c to be as small as possible. I'm trying to minimize the sum of the lengths to the vertices. The way that I've set up this problem. The way that I've exactly positioned these 3 vertices introduces a symmetry that we can exploit in this problem. This configuration is symmetric across the line y equals x and the bubbles really shouldn't prefer one side or the other. I mean, what does bubble knows about left and right? So the solution, the point that minimizes the sum of the distances to these 3 vertices should lie on this line, so I can say that its coordinates are x,x, so what's the goal? So I'm trying to find the value of x, so, that this point x,x minimizes the sum of the distances to the 3 vertices. Now, how do I write that down? Well, here's a formula for the sum of the distances to these 3 vertices. This first part, the square root of x squared plus x squared. That's just the Pythagorean Theorem, right? How far is the point x,x from the point 0,0? Well, here's a right triangle. And the two legs of this right triangle both have length x. So, the length of a hypotenuse is he square root of x squared plus x squared. What, say, this term here, where is the square root of 1 minus x squared plus x squared come from? Well, take a look at this little tiny right triangle here. This right triangle has this leg with length x and this leg with length 1 minus x. So, how long is the hypotenuse, which is the distance from x,x to 1,0? Well, it's the square root of 1 minus x squared plus x squared. This last term, this square root of x squared plus one minus x squared, that's measuring the distance from 0,1 down to x,x. I can simplify this, somewhat. This first term, this square root of x squared plus x squared, well, I could rewrite that as just the square root of 2x squared. And both of these terms are actually the same. It's just the addition is done in a different order but, of course, it doesn't effect the value at all so I can write this as two copies of just this first one, the square root of 1 minus x squared plus x square. So, this is a slightly easier way of writing f. We should also review if there's any constraints on this problem. I'm going to find it a little bit easier if I assume that x is bigger than or equal to 0. In that case, the square root of 2x squared can be rewritten in an even easier way, right? The square root of x squared is the absolute value of x. But if I assume that x is bigger than or equal to 0, then I could rewrite this as just the square root of 2 times x plus, and this other term, 2 times the square root of 1 minus x squared plus x squared. So, we've got our function of a single variable so we can apply calculus. We can differentiate. So, here we go. I want to differentiate this. F prime is, well, it's the derivative of a sum, which is the sum of the derivative. So, I have to first differentiate square root of 2 times x. As just the square root of 2 plus 2 times something. So, it will be 2 times the derivative of that thing. It is the derivative of 1 minus x squared plus x squared, all under this square root. Alright, and I can keep on going here. I got the square root of 2 plus 2 times. How do I differentiate a square root? Well, the derivative of the square root is 1 over 2 times the square root but I use the chain rule so it will be 1 over 2 times the square of the inside function here, which is 1 minus x squared plus x squared times the derivative of the inside function. So, the derivative of 1 minus x squared plus x squared. Alright, let's do this again. So, I got the square root of 2, plus, oh, I can cancel this 2 and this 2, so, I've got 1 over the square root of 1 minus x squared plus x squared times, I got to differentiate this sum, which is the sum of derivatives again. So, the derivative of 1 minus x squared, that's 2 times one minus x times the derivative of the inside function, the derivation of 1 minus x is minus 1, plus the derivative of x squared, which is just 2x. So, here's the derivative of f. With the derivative in hand, we can look for the critical points, places where the function either isn't differentiable or where the derivative is equal to 0. I don't have to worry about critical points where the derivative doesn't exist because this function is differentiable everywhere. So, I'm just looking for values of x where the derivative is equal to 0. Let me rewrite this derivative even a little bit more nicely. So, the derivative is the square root of 2 plus, and it's this thing I want to simplify a little bit here. What do I got? I got 2x. And then I've got another 2x here. So, it's 4x minus 2. So, 4x minus 2 over this denominator, the square root of 1 minus x squared plus x squared. Alright, pretty good. I'm looking for values of x where that thing is equal to 0. I'll subtract the square root of 2 from both sides. That means I'm looking for values of x. So that 4x minus 2 over the square root of 1 minus x squared plus x squared, is equal to negative square root of 2. And then, I'll multiply both sides by this denominator. And that means I'm looking for values of x. So that 4x minus 2 is negative the square root of 2 times the square root of 1 minus x squared plus x squared. Now, how do I solve an equation like this? Well, one trick I can use is to square both sides, and that might introduce extra solutions. But I can go back then and, and figure out exactly which solution is still a solution to this original problem. So, let's square both sides. So, I've got 4x minus 2 squared is negative square root of 2 times 1 minus x squared plus x squared, this whole thing squared. And now, I can expand that out a bit, right? What's 4x minus 2 squared? Well, that's 16x squared minus 16x plus 4. And what's this side? Well, squaring the negative gets rid of it. Squaring the square root of 2 is 2, and then the square of this thing, this is positive so it's just whatever is inside the radical, which is 1 minus x squared plus x squared. Okay, so I got 16x squared minus 16x plus 4. I can expand this thing out. Alright, this is a 1 minus 2x and then here, I got a plus x squared and another x squared so plus 2x squared. I'll expand this whole side out so that's 2 minus 4x plus 4x squared and I'll subtract this from both sides and I'll get 12x uh,squared minus 12x plus 2, is equal to 0. So, this is just a quadratic equation, alright, and I can solve that quadratic equation by using say, a quadratic formula. And I get that x is 1 half 1 plus or minus 1 over the square root of 3, alright? So this is an application of the quadratic equation to solve this, quadratic. Now, the issue here is that, it turns out that I'm getting 2 solutions for x. But only 1 of these is actually a place where the derivative is equal to zero. So if you're careful, and you check. It turns out that this is in fact, a minus sign. So this is the only critical point x equals 1 half 1 minus 1 over the square root of 3. So, I've got a critical point. Let's draw a picture and see exactly where the critical point lands inside our triangle. So, doing a little bit of numerics this critical point ends up at being at point 2,1 and yeah, I mean I can plot this right here. This is the point x,x when x is equal to this. And, you know, maybe that looks believable as where these bubble walls would intersect in order to minimize the sum of these 3 distances. There's more work to do. To actually show that critical point does indeed give rise to the global minimum value of this function, we need to do more work. But let's put that off for now. Instead, I want to focus in on an angle calculation. In particular, I want to calculate this angle here, the angle that this bubble and this bubble make at the point where they intersect. And I can do that with the law of sines calculation but I also need to know to the length of this piece of the bubble and if you do the calculation, that will be the square of 2 3rd. Alright, so I'm going to use the fact that I know this length, oh, and I also know this bottom length is 1 and I know this angle, right? The line y equals x makes a 45-degree angle with the x-axis. So, I put all that information together into a law of sines calculation, right? Sine of pi over 4, that's this angle, a 45-degree angle divided by the length of the opposite side the square root of 2 3rd. Well, that sine of theta divided by the length of the opposite side which is 1. Now, I want to try to figure out what sine of theta is. Well, I've got all the bits of information here that I need. I know sine of pi over 4 is 1 over the square root of 2. So, it's 1 over the square root of 2, divided by the square root of 2 3rd is equal to sine of theta. And this, yeah, if it calculate it, it's the square root of 3 over 2. Now, you might be tempted just to apply arc sine to the square root of three over two. But you have to think a little bit about the domain here, exactly where does this angle theta lie? It's not between 0 and 90 degrees. A theta, if you look at the picture, is bigger than 90 degrees, so I'm looking for an angle between, say, 90 and 180 degrees whose sine is the square root of 3 over 2, and that actually nails down theta for us. Theta is 2 pi over three radians or 120 degrees. So, these bubble walls meet at 120 degree angles and we can see this for real in nature. Look at these 120 degree angles. The calculations that we're doing here are just symbols on the page. And yet, somehow, they manage to govern the real physical world, right? What do bubbles know about Calculus? But somehow, Calculus knows about bubbles.