 Welcome back everyone to part 39 of our lecture series, Math 1210 Calculus I for students at Southern Utah University. As usual, I'm your professor, Dr. Andrew Misaline. How are you doing today everyone? Lecture 39 entitled, Robots in Disguise. This is a continuation of the previous lecture about optimization problems and hence the puns relevant to transformers will continue on in this lecture as well. Mostly, I just wanted to give some more examples of how optimization problems work because again, we only got like three examples in the previous lecture. They take about 10 minutes to do one of them with any justice here. I wanted to do a couple more for everyone's benefit and knowledge as well. I should also point out that the examples from this lecture are for the most part based upon examples from Jane Stewart's Calculus textbook. It's a great book, take a look at it sometime. We're going to look at some more optimization problems. Remember, optimization is all about either making a variable get the biggest possible it could be or the smallest possible it could be. There's some quantity we're trying to make big or get small, and trying to figure that out in this lecture. For this first example, imagine that a man launches his boat from point A on the bank of a straight river three kilometers wide and wants to reach a point B which is eight kilometers downstream on the opposite bank as quickly as possible. So imagine like he's in a race, this athlete in a race and part of the race is he has to cross this river, and he has to row across the river in order to do it. Well, he could row his boat directly across the river to some point C, and then run directly to B. So one option is he just goes directly across the river, whoops, directly across and then runs the whole way. Now, that right there already is going to maximize the distance that he travels. So that might not be the best idea. Another option is that he could row directly to the point B from A. That would actually minimize distance if he did that, or one other option is he could go from A to some point D in the middle, and then run the rest of the way. That is some of the time could be in the water, some of the time could be on land. Well, what's the best option here? Well, it depends on what's he trying to optimize. If he's trying to minimize distance, he should row directly to A from A to B. If he's trying to maximize distance, he should go from A to C and then to B. But he really is trying to do it so that he can get there as quickly as possible. Quickly as possible means that this man, this athlete here, is trying to minimize time. He wants the shortest time. He's in a race. It doesn't matter about distance. It doesn't matter about speed. It matters by time. How can you get there faster? Now, admittedly, speed and distance will affect these things, and so that's how he's going to make this decision. Well, so if the man can row at a rate of six kilometers per hour, six kilometers per hour is his rowing speed, and then he can run eight kilometers per hour. So he can run faster than he can row. So there is a benefit of having a lot of running distance and cutting the rowing distance short. But if he cuts the rowing two distance, he adds a lot of extra distance along the journey, and so it might not be the right thing. How does he optimize all these things together? Well, so he has to decide how far is he going to row down the river and how much is he going to run? So imagine that if you think of just the horizontal distance, the distance between the points C and D call that x. Well, if the total distance between C and B is 8, then we see that the distance from D to B will be 8 minus x. And how about the distance from A to D? Well, as this is part of a right triangle, one side is x, the other side is 3, the distance along the diagonal is going to be the square root of x squared plus 9, just using the Pythagorean equation right there. And so if you try to calculate time, we often use the following rate formula where distance equals rate by time, that is speed times time. If we try to minimize time, we can solve for this by taking distance over your speed, that's equal to your time, right? But there's really two parts of this question. The total time is going to represent the time that he's in the water plus the time that he's on the land. Now, I imagine there might be some math professor who just died somewhere because of how I wrote this equation. Land plus water equals time, what the heck does that even mean? It is somewhat nonsensical, but I think it's not a bad practice to sort of write these simplistic equations and add details and specifications later on so that we can get a good intuition of what's going on here and then we can add more detail. So there's the time he spends on land and there's the time he spends on the water there. Well, if we look at the water time a little bit more, there's the distance over the water, which we found out a moment ago was the square root of x squared plus nine and this we measured in kilometers and this would be divided by his speed on the water, which is six kilometers per hour. And then there's the time he spends on land, which the distance he spends on land is eight minus x and then he runs at eight kilometers per hour. Now, admittedly, there might be other ways of setting this problem up. I did choose the variable x to be the distance between C and D to try to simplify the forthcoming equation, this equation right here, this optimizing function, but one could make other choices as well. Now, as every optimization problem, it always has an optimizing function. This is the function we just built and honestly, I think building the optimizing function really is the hardest part of optimization problem. The calculations of the derivative are fairly routine and then there's always a constraint and the constraint that comes into this problem, of course, are the distances involved, but also the speeds that the men can run a row. So if we take the derivative of time with respect to our choice x here, right, we're gonna get one sixth, take the derivative using the chain rule right here, we're gonna get one half x squared plus nine to the negative one half power times that by a two x, the inner derivative. And then over here, we're gonna get one eighth times the derivative, which would be negative one. We're taking the derivative with respect to x here. Simplifying some things, for example, this one half cancels with the two right here. And well, I mean, we can write things as fractions again. We're gonna have an x on top for the first piece and then we get six times the square root of x squared plus nine and then we subtract eight from that. And this is our t prime. We're looking for critical numbers right now, set this equal to zero. And so you don't necessarily have to worry about cleaning up the derivative too much. Simplification's not a big deal. Just start solving for x right here. And if you do that, you're gonna get x over six times the square root again. And this will equal one eighth. And so my recommendation here is, since we have a proportion equal to a proportion, let's cross multiply like so. This is gonna give us eight x is equal to six times the square root of x squared plus nine. I don't really like the square root involved there, so I'm gonna square both sides. Won't you always be cautious? So when you start squaring things, excuse me, you might add extraneous solutions into the system that is these party crashers, solutions who weren't invited. We'll just check our answer before we're done here. And so if you square both sides, we get 64 x squared is equal to 36. Don't forget to square that x squared plus nine. Like so distribute the 36 on the other side, of course. Oh, I guess actually before we distribute, I take that back. It's always better, I think, to divide before you can multiply if there's some common factors. Because after all, 64 and 36 have a common divisor. Let's see, 36 is four times nine and 64 is eight squared, which means it is just four times 16. So you can cancel out the fours there. And so we end up with 16 x squared is equal to nine x squared plus nine. Now distribute. You get nine x squared plus 81. If you subtract nine x squared from both sides, all right, you're gonna get seven x squared equals 81. That is x squared equals 81 over seven. And if you take the square root, you're gonna get nine over the square of seven. This is our critical number, but there are some domain concerns we should have, x and t. So nine over the square of seven sits in the middle. What's the domain right here? If we come back to the original picture, the slides here, the original picture, well, we kind of talked about the two extremes one could take. One could take the journey where you just go directly across the water to sea. That would be setting x equal to zero, right? The other possibility of extreme is you take a directly to b, in which case that would be taking x equal eight. And so that's gonna be the domain of the problem here from zero to eight, zero, eight. And beware, nine divided by the square of seven is approximately 3.4 kilometers. So it does sit inside there. If you sit x equal to zero, plug x back into the original function, you're gonna get the square root of zero squared plus nine. That's a three over six. Three over six gives us one half. So 30 minutes will spin on the water. Minutes on the water. And then he has to run eight kilometers and he can run eight kilometers per hour. So that's one hour right there on the land. And so he'll spend one and a half hours if he just rose directly across. If we did the other extreme where we did eight, right, that the land parts easy, you're gonna get zero hours on land. But in terms of going across the water, if you plug in the eight, you get eight squared plus nine. Take the square root. And then divide by six in that situation, you're gonna get the square root of 73 over six, which that's approximately 1.42 hours. Let me lower that a little bit. 1.42. And so that is a little bit better. It is better for the man to row directly across than directly, it's better for him to go entirely across the water than to go directly across because he does shave off a few minutes there. But if you were to plug in nine over the square root of seven, you actually end up with one plus the square root of seven over eight, if you want an exact answer. In terms of approximation though, you'll get 1.33. So about an hour and 20 minutes. And so that's gonna be our optimal situation right here. This is the fastest approach. He should actually go approximately, what we say before, 3.4 kilometers down the stream. And that'll save this man a couple of minutes, right? So, because after all, the 1.5 would be an hour and 30 minutes. 1.33 is about our 20 minutes. And so by this strategy, as opposed to taking the first option, he saves himself about 10 minutes. He's not gonna get as good with this option, but he does still save himself about five or seven minutes. And in which case, this is still a better solution. After all, the man's in a race right here. He wants to win the race. And so saving those couple of minutes could be very, very useful. Now, of course, you'll notice we spent like 10 minutes on this problem itself. So if his point was to sit down, solve the problem to save time, clearly that didn't work for him. He would have been better just making a bad choice than trying to sit down and solve the problem. But really most likely for our athlete here is he knew the track long before he actually ran it. And so they could actually, he and his team, his coach could sit down and figure out what is the best strategy to take for this prior to getting there. And so this is the thing that sometimes gives calculus a bad name and other mathematical problems is we realize how long it takes to solve the problem. And some people are like, oh, I would be faster if I just guessed and checked, right? In some situations, yeah, in this situation, yeah. If he was in the middle of the race, it would not have been profitable for him to stop and solve this calculus problem. But if he could have done this prior to the race, he could have saved himself a lot of time that might make the difference in this competition. So mathematics is about planning ahead, defining good solutions here. Optimization's all about that. I wanna present you another problem that's almost identical to what we just did before. Some of the languages is different, but it's giving me basically the same problem as you can see. Imagine we have a Boy Scout who's participating in the sport of orientating. Now, if your nerd sense is going off right now, that's because orientating is the sport of compass, using a compass, right? So not a lot of people probably know how to do that nowadays, but it's kind of a thing that a nerdy Boy Scout would do. Shockingly, I did this myself when I was about 14 years old, 13 years old. Anyways, so he's participating in the sport of orientating. He must find a specific tree in the woods as fast as possible. So again, it's a race. So like the last one, he has to do it in the fastest time possible. It doesn't matter about speed, it doesn't matter about distance. He needs to do it fast. It's part of a race. So he can get there by traveling east along the trail for 300 meters, as you can see illustrated. And then north through the woods for 800 meters, you'll notice that the diagram is not drawn to scale. They never are. He can run 160 meters per minute along the trail, but only 70 meters per minute through the woods, because he doesn't wanna run as fast. He might trip on a rock or run to a tree or something. Running directly through the woods towards the tree minimizes the distance, but he'll be going slowly the whole time, kind of like with our rower, right? When the rower went diagonal, he went slower than we went straight. So find the path that'll give the Boy Scout to the tree in the minimum amount of time. Same basic ideas last time. We're gonna say X is the distance from where he leaves the trail to the end of the trail. Then we're gonna get 300 minus X right here as the distance he'll run along the trail. And then you get the square root of X squared plus 800 squared as the distance he'll run through the forest there. He can go down the trail at a speed of 160 meters per minute and then he can run through the woods at only 70 meters per minute. What's the optimal solution? Well, it's gonna be very similar as before. Time, we call the time he spends on the trail plus the time he spends in the woods. The time he spends on along the trail will be 300 minus seven meters divided by 160 meters per minute. That'll give us minutes. And then the time he spends in the woods will take the square root of X squared plus 800 squared all over 70. You'll notice I haven't squared 800 yet. I'm not going to for a while. I'm practicing what is often referred to computer science as lazy computation. I will get around to it when I finally see a need. I don't see it yet, so I'm gonna wait. If we take the derivative of T with respect to X we'll get negative one over 160 plus we're going to get 170th times one-half times X squared plus 800 squared to the negative one-half power and times that by two X. You'll notice again that this one-half cancels with this two and we get zero equals negative 160th. We end up right, I'm sorry, not equals. That should be plus X sits above 70 times the square root of X squared plus 800 squared. I mean, you'll see this calculation is almost the same thing, right? We could actually have put some variables in the original setting and try to solve this optimization problem in general. We're not gonna be that ambitious right here. So X over 70 times the square root equals one over 160. Again, we will cross multiply. We get that 160 X equals 70 times the square root. Here, there is a common factor of 10 between 70 and 160, let's cancel that out. And so then square both sides, we're gonna get 16 squared, which is 256 times X squared. This equals X, I'm sorry, 49. Don't forget that, 49 X squared plus 800 squared. Distribute the 49, we get 49 X squared plus 49 times 800 squared. Aha, I'm still being lazy in my computation here. So track 49 X squared from both sides, you'll get 207 X squared equals 49 times 800 squared. And so divide both sides by 270, not 270, 207. So you get X squared equals 49 times 800 squared over 207. And so then if we take the square root, you can see my laziness has paid off. X equals seven times 800. I never knew how to know what 800 squared was, the square root of 207. And so that right there is approximately 389 meters. Okay, coming back up to the picture above, what's the feasible range for X right here? Well, X could be zero, in which case, the boy runs immediately through the woods. And X could all be up the way to 300 who runs to the end of the trail and then goes through the forest like that. 389, isn't that what we just got a moment ago? That would be like running down here and going backwards through that. That's not gonna be an optimal solution. That's outside the domain right here. So it's like, huh, weird. And so if we look at our t-chart that we're gonna create, turns out we don't want this number. The critical number doesn't work. I mean, it does work, but it doesn't give us the optimal solution we're looking for. So we're looking for zero to 300, which if you plug in zero, it'll take the boy 13.3 minutes. And if he goes down the end of the trail 300, then gets off, then it'll take him 12.21 minutes. And so this right here will give us the optimal solution. This is the minimum value. And so like I was mentioning before, in the last video I mentioned, I don't know if I don't remember mentioning in this video here, but when it comes to optimization, the critical numbers do not always give us the best answer. They oftentimes do. And because they do so often, we kind of forget that they're not the only options. The endpoints might be optimal solutions as well. In terms of this case, minimizing the best strategy for the boy will be run 300 meters down the trail to the end, and then go, then go. I mean, the trail doesn't end at 300 meters, but if he keeps on going, that's gonna add more distance, more time than necessary. So do always make sure you're checking the endpoints, not at the endpoints, do always make sure you're checking the endpoints, not just the critical numbers. Sometimes the endpoints are silly. They give you like zero or infinity or things like that, but they actually can give you the optimal solution. So watch out for them. All right, let's do one more example, and that'll put us at the end of this section right here, 4.7. This one's a three-dimensional picture. You're gonna have to bear with me a little bit as we try to draw 3D for a moment. Imagine we want to make an open box by cutting off the square corners of this square, and then we can fold it up. We can fold these flaps up and make a box like so. So we're gonna make an open box by cutting a square from each corner of a 12-inch by 12-inch piece of metal, and then folding up the sides. What side square should we cut off for each corner to produce a box of maximum volume? So let's focus on that for a moment. We want to maximize volume. It's gonna be a box when we're nice and done, so that is we get this rectangular prism, and it doesn't have a top, so this is open right here. But what's gonna be the dimensions of this thing? The volume will equal length times width times height. Now, when we fold the thing up, let's say that we cut off x from each corner, so an x by x corner. When you fold this thing upwards, then the height of this box is gonna be the dimension x right there. What about the length and width? Well, the base square is gonna be this right here. And if the whole thing was 12 inches, if we cut off x and we cut off x, that'll leave behind 12 minus two x. And that's gonna give us the length of this thing. And it is a square, so it's gonna be the same thing right here as well, 12 minus two x for the other side. And so then our volume will look like 12 minus two x, 12 minus two x, and x, which 12 minus two x, it does have a factor of two, you can factor that out. So you get four times six minus x squared times x. This is our optimizing function. Where was the constraint? Well, the constraint actually came into the, into the metal square itself. It was only 12 inches by 12 inches, and that's how the constraint came into place. We actually had three variables in the original situation. One of them was x, the height was just x, so maybe you think we had three variables we had length and width, which we were able to remove and replace in terms of x there. So since this thing is a square, I'm gonna leave it factored as I take the derivative or use the product rule this time. We're gonna get four times two times six minus x times negative one. Don't forget the inner derivative times x plus, well, the derivative of x is just one, so we get six minus x squared here. Let's see, so there is a common factor of six minus x here and here. We're gonna factor that out. So we get four times six minus x. And then what's left behind is a negative two x plus six minus x, like so. Combining some like terms, we end up with six minus three x and six minus three has a common factor of three again, so factor that out. So we're gonna get 12 times six minus x, and then we get two minus x. So we're gonna find two critical numbers, x equals six and x equals two. So consider the domain of this situation. I'm gonna come back to the original picture. So as we fold these things up, clearly the smallest that x could be is zero. But how big could it be? Like if we put all of it into height, what would happen? It would be like we took this square and cut it up into four squares. That's gonna be the limit of how big x can be, and this would be six and six and six and six everywhere. So x equals six is gonna be the biggest we can get here. All right, let's scroll back down again. Oh, six was a critical number, how convenient. So as we build our t chart, we're gonna consider x as it ranges from zero to six, and we have a two in the middle. Two seems very likely to be our maximum volume. If x equals zero, then the volume is zero because it has no height. If x equals six, the volume will also be zero because it has no length or width. Two seems to be very, very helpful right here. If the height is two, then we take 12 minus two, that is 12 minus four, which will be eight, which would be the length and the width. And so you're gonna get eight square, which is 64, double that, you get 128. This will be 128 cubic inches, isn't it? So, and that's gonna be our maximum, maximum volume. We wanna cut off a two inch square from each corner, fold it with our metal folding machine, and then we're gonna have this maximum volume of 128 cubic centimeters. So the final answer is to cut a two by two, cut two by two corners. And this will give us the maximum volume. And so I guess it's a few more examples of optimization problems for today. I hope this was fun. Optimization never really goes away. These are some of the most important types of applications that the derivative one can see. Optimization problems are everywhere, certainly everywhere. We're always trying to do the best with the resources we got. And Calculus becomes a critical tool in helping one with those type of problems. If you liked the video today, feel free to leave a comment. If you have any questions, also feel free to comment and ask your questions. I'll be glad to answer them as soon as those appear. We will talk about Newton's method next time. In the meanwhile, feel free to subscribe to get more updates about these videos in the future. And I will see you then. Have a good day, everyone.