 And so we're going to look at some more optimization problems. So 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 it's time to figure that out in this lecture. So 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's 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, 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 gonna 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 gonna row down the river and how much is he gonna run? So imagine that if you think of just the horizontal distance, the distance between the point C and D call that X. Well, if the total distance between C and B is eight, then we see that the distance from D to B will be eight 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 three, the distance along the diagonal is gonna be the square root of X squared plus nine, 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 gonna 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 was 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 have made 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. One should 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 you weren't invited but 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 C that would be setting X equal to zero, right? The other possibility of extreme you should 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 be aware 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 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