Welcome to my video on optimization. In this example, we are given the demand and the cost functions. And what we need to do is find the number of units x which produces the maximum profit. Um so let's take a look at these two functions which are given to us. We'll start with the demand function. What this demand function is telling us is the price of the product. That's why it's labeled with a P. The demand is the price of the product based on how many units X are available. And notice the higher the value of X, the lower the value of P is going to be, which which makes sense because the higher the supply, the lower the demand or the lower the price of the product is going to be. So this demand function is just another way of expressing price. So now let's take a look at the cost function. The cost is represented by C. C is equal to 1,200x plus 2600. And notice how the higher the value for X, the higher the cost is going to be, which makes sense. The more units you produce, the higher the cost it's going to take to produce them. So these are the two equations which we will be using in this example. So now let's take a look at all of the steps we need to use to perform an optimization problem. So here we have step number one. Step number one says to find the equation to maximize or minimize. So if we go back to our example, we need to find the equation to maximize or minimize. So notice in this question it says find the number of units x which produces the maximum profit. So this profit is what we need to maximize. So how do we find the equation for profit? Well, if you use your natural intuition, you know that the profit is equal to the total amount of money you receive from selling a product minus the cost it takes to produce that product. So here I wrote the equation down for you. The profit is equal to the revenue. Uh the revenue is just the total amount of money you receive from selling the product minus the cost. The cost to produce that product, which makes sense. For example, if you have a product and you sell the product for $50. So you receive $50 in revenue, but that same product takes you $20 in cost to produce. Your profit would be the $50 in revenue minus the $20 it cost you to produce. And so 50 minus 20 would be a $30 profit. So you could use your natural intuition to figure out how to find this profit equation. So this profit equation is what we are trying to maximize. And now we are ready to move on to step number two. So step number two says to reduce this equation to one variable. So if we go back to our example, we need to reduce this profit equation in terms of one variable. At the moment it's written in terms of revenue and cost. So first let's take a look at revenue. Like I said earlier, revenue is just the total amount of money you receive. So if you have 10 units of a product and you sell that product for $5 a piece, five time 10 is equal to 50. So your revenue would be equal to $50. So the revenue is equal to the price of the product multiplied by the number of units sold. So once again, the revenue is equal to the price of the product multiplied by the number of units sold. X. All right. So now let's pay attention in particular to the price of the product and try and rewrite this in terms of x. Well, we know from the demand equation which is another way of expressing price, the price p is equal to 3,000 - 2x. So in this profit equation, we can replace the price with 300 - 2x. So now we have rewritten the revenue in terms of one variable x. The revenue is equal to the price which is 3,000 - 2x multiplied by the number of units that are sold which is just x. Um so now let's do this same exact thing for the cost. Let's try and rewrite the cost in terms of one variable x. So the cost is already given to us in terms of x. We know the cost which is C is equal to 1,200X plus 2600. Um so we can replace the cost with 1200X plus 2600. Um so this revenue which is being subtracted by the cost and once again the cost can be replaced with 1200X plus 2600. All right. So now we have written the profit equation in terms of one variable X. this profit, which I'll just label with a capital P since I'm running out of space here. The profit is equal to 3,00 - 2x multiplied times X. And this is all being subtracted by 1200X plus 2600. But before we move on to the next step, let's simplify this profit equation just a little bit further. So the first thing I'm going to do is just distribute. I'm going to distribute this X with the -2X and the positive 30,000. um x * -2x is equal to -2x^2 and x * * 300 is equal to a positive 3000x. And now I'm going to do the same thing with the right side of the equation. And we have a negative 1. Even though there's no one there, there's an implied one always. The negative 1 is being multiplied with a positive 1200x. So that is equal to 1,200x. And notice how we have two like terms 3,00x and -1200x. If we combine them, 3,00 - 1200 is equal to 1,800. So I'm going to erase these and replace them with a positive 1,800x. And now last but not least we need to multiply this negative 1 with a positive 2600 which is equal to negative 2600. So now we have simplified this profit equation as much as possible. It's written in terms of one variable x and now we are ready to move on to step number three. So step number three says to find the critical values which means we need to take the derivative and set it equal to zero. So if we go back to our example we need to take the derivative of this profit function and set it equal to zero. So the derivative of the profit with respect to x is equal to the derivative of -2x^2 which is equal to -4x plus the derivative of positive800x which is just equal to 1,800 plus the derivative of - 2600 which is equal to zero. So this is our derivative with respect to x and we need to set it equal to zero to find the critical values. So now the only thing we need to do is just solve for x. So this is an easy equation to solve. The first thing I'm going to do is subtract 1,800 from both sides. And on the left side of the equation, the positive 1800 and negative 1800 cancel each other out and we're left with negative 4x and that is equal to the right side which is which is 0 -800 which is equal to800. Now to get x by itself we can divide both sides by -4. Divide both sides by4 on the left the4s cancel each other out and we're left with x. So x is equal to800 / -4 which is equal to a positive 450. So our critical value x is equal to 450. And now we are ready to move on to step number four. So step number four says to verify if the critical values are maximums or minimums. So if we go back to our example, we need to verify if this critical value of 450 is a maximum or a minimum or possibly it could be neither. So how do we test to see if this is a max or a min? What I like to do is the second derivative test. So I'm going to perform the second derivative test here on the right in blue. Now the first thing I'm going to do is just rewrite my first derivative which was equal to -4x + 1800. So the second derivative with respect to x is equal to the derivative of -4x which is equal to -4 plus the derivative of positive 1800 which is equal to zero. So our second derivative is equal to -4. All right. So now we need to verify if this critical value of 450 is a max or a min. So to do this, we need to plug it into our second derivative. So if we plug 450 into our second derivative, notice how our second derivative is a constant. It's -4. So no matter what value for x you plug into your second derivative, it's always going to be equal to -4. And if your second derivative is negative, that means your critical value is going to be a maximum. This verifies that our critical value of 450 is indeed a maximum which is good because the question is asking us to find the maximum profit. So this critical value had to be a maximum. All right. So now we are ready to answer our question. It says find the number of units x which produces the maximum profit. Well, we know if x was equal to 450 that was indeed a maximum. So 450 units is our answer. This is the number of units that if we produce will produce the maximum profit. So I hope this video gave you a better idea on how to perform optimization problems. There are many other examples which are much different. So that's why I made four other optimization videos as well. The links for these videos are in the screen and the description for each example that I use is in red so you can see which example I use in the video. So thank you so much for watching and I will see you in my next one.