1 00:00:18,090 --> 00:00:25,780 in this class we will study the algebraic method to solve linear programming problems 2 00:00:25,780 --> 00:00:32,460 we will begin by considering a maximization problem subject to less than or equal to constraints 3 00:00:32,460 --> 00:00:40,530 we will look at the same example that we used to illustrate the graphical method so we go 4 00:00:40,530 --> 00:00:48,100 back to the same maximization problem which maximizes ten x one plus nine x two subject 5 00:00:48,100 --> 00:00:53,920 to three x one plus three x two less than or equal to twenty one and four x one plus 6 00:00:53,920 --> 00:01:02,500 three x two less than or equal to twenty four x one x two greater than or equal to zero 7 00:01:02,500 --> 00:01:09,060 now in order to solve this algebraically let us first look only at the constraints for 8 00:01:09,060 --> 00:01:15,410 for a moment let us set aside the objective function and for a moment let us set aside 9 00:01:15,410 --> 00:01:21,190 the non negativity so we are looking at three x one plus three x two less than or equal 10 00:01:21,190 --> 00:01:27,830 to twenty one and four x one plus three x two less than or equal to twenty four so we 11 00:01:27,830 --> 00:01:36,800 have two inequalities so at the moment let's again assume that we know to solve equations 12 00:01:36,800 --> 00:01:42,450 while we don't know at the moment to solve inequalities so under the assumption that 13 00:01:42,450 --> 00:01:49,979 we know to solve equations let us see how we can apply that idea to solving the two 14 00:01:49,979 --> 00:01:58,200 given inequalities so in order to solve them as equations the first thing is to write them 15 00:01:58,200 --> 00:02:05,819 as equations from inequalities so we have three x one plus three x two less 16 00:02:05,819 --> 00:02:13,990 than or equal to twenty one and x one x two greater than or equal to zero so if we have 17 00:02:13,990 --> 00:02:21,120 to satisfy x one x two greater than or equal to zero and three x one plus three x two less 18 00:02:21,120 --> 00:02:29,299 than or equal to twenty one it is now possible to introduce another variable called x three 19 00:02:29,299 --> 00:02:35,650 and write three x one plus three x two less than or equal to twenty one as three x one 20 00:02:35,650 --> 00:02:44,489 plus three x two plus x three equal to twenty one which is what we have shown here we have 21 00:02:44,489 --> 00:02:56,450 written three x one plus three x two plus x three equal to twenty one now since x one 22 00:02:56,450 --> 00:03:02,310 and x two have to be they have to be greater than or equal to zero and they have to satisfy 23 00:03:02,310 --> 00:03:07,480 three x one plus three x two less than or equal to twenty one therefore three x one 24 00:03:07,480 --> 00:03:13,760 plus three x two can either be equal to twenty one in which case x three will be equal to 25 00:03:13,760 --> 00:03:20,450 zero or if three x one plus three x two is less than twenty one then x three will take 26 00:03:20,450 --> 00:03:28,359 a positive value therefore x three will now be defined as greater than or equal to zero 27 00:03:28,359 --> 00:03:34,359 so x three is greater than or equal to zero so three x one plus three x two less than 28 00:03:34,359 --> 00:03:41,769 or equal to twenty one is now rewritten as three x one plus three x two plus x three 29 00:03:41,769 --> 00:03:50,750 equal to twenty one its written as three x one plus three x two plus x three equal to 30 00:03:50,750 --> 00:03:55,659 twenty one and x three greater than or equal to zero 31 00:03:55,659 --> 00:04:01,749 in a similar manner four x one plus three x two less than or equal to twenty four is 32 00:04:01,749 --> 00:04:08,760 written as four x one plus three x two so it's written as four x one plus three x two 33 00:04:08,760 --> 00:04:17,100 plus x four equal to twenty four and x four will be greater than or equal to zero now 34 00:04:17,100 --> 00:04:24,410 x four is greater than or equal to zero because if four x one plus three x two is equal to 35 00:04:24,410 --> 00:04:30,370 twenty four then x four will become zero if four x one plus three x two is less than twenty 36 00:04:30,370 --> 00:04:36,330 four then x four will take a positive value therefore x four is greater than or equal 37 00:04:36,330 --> 00:04:40,770 to zero so the given problem maximize ten x one plus 38 00:04:40,770 --> 00:04:46,599 nine x two subject to three x one plus three x two less than equal to twenty one four x 39 00:04:46,599 --> 00:04:51,259 one plus three x two less than equal to twenty four x one x two greater than or equal to 40 00:04:51,259 --> 00:04:57,960 zero is now written as maximize ten x one plus nine x two plus zero x three plus zero 41 00:04:57,960 --> 00:05:05,210 x four subject to three x one plus three x two plus x three equal to twenty one four 42 00:05:05,210 --> 00:05:12,580 x one plus three x two plus x four equal to twenty four x one x two x three x four greater 43 00:05:12,580 --> 00:05:33,139 than or equal to zero now these variables x three and x four that are written here 44 00:05:33,139 --> 00:05:40,199 these variables x three and x four that are written here are called slack variables now 45 00:05:40,199 --> 00:05:48,629 these slack variables are used to convert an inequality into an equation so this inequality 46 00:05:48,629 --> 00:05:55,610 is converted to an equation by the addition of slack variables 47 00:05:55,610 --> 00:06:02,020 now we when we formulated the problem we said the revenue associated with x one is ten the 48 00:06:02,020 --> 00:06:09,560 revenue associated with x two is nine so the revenue or profit or money that is associated 49 00:06:09,560 --> 00:06:21,120 with x three and x four are zero the money associated with x three and x four are zero 50 00:06:21,120 --> 00:06:28,300 and it is assumed that they do not contribute to the objective function now we have converted 51 00:06:28,300 --> 00:06:34,550 a problem with inequalities into a problem with equations and we now try to solve this 52 00:06:34,550 --> 00:06:40,490 problem now we started by saying that since we know to solve equations we will now look 53 00:06:40,490 --> 00:06:46,639 at these two equations and try to solve them so we have two equations but now with the 54 00:06:46,639 --> 00:06:53,080 addition of the two slack variables we now have four variables x one x two x three and 55 00:06:53,080 --> 00:07:02,319 x four when we learnt methods to solve linear equations we learnt methods where the number 56 00:07:02,319 --> 00:07:09,240 of variables that we solve is equal to the number of equations but now in our example 57 00:07:09,240 --> 00:07:15,860 we have four variables and we have two equations now when we have two equations we can solve 58 00:07:15,860 --> 00:07:22,729 only for two variables now we have to find out a way by which we solve for two variables 59 00:07:22,729 --> 00:07:32,230 at a time when we have four variables and two equations so let us now see how we solve 60 00:07:32,230 --> 00:07:36,280 this so the problem that we have now it or we are 61 00:07:36,280 --> 00:07:46,470 now going to solve is given on the right hand side the problem that we are going to solve 62 00:07:46,470 --> 00:07:54,110 is given here maximize ten x one plus nine x two plus zero x three plus zero x four subject 63 00:07:54,110 --> 00:08:04,250 to subject to the first equation here second equation here and son on so there are four 64 00:08:04,250 --> 00:08:11,870 variables and two equations and since we have two equations we can solve only for two variables 65 00:08:11,870 --> 00:08:19,300 at a time so we choose two variables that we are going to solve which means the other 66 00:08:19,300 --> 00:08:26,159 two variables that we are not going to solve we have to give them some value for example 67 00:08:26,159 --> 00:08:32,250 if we assume that we are going to solve for x one and x two we need to give some value 68 00:08:32,250 --> 00:08:40,190 for x three and x four if we give a value of one for x three and x four then the equations 69 00:08:40,190 --> 00:08:46,190 will become three x one plus three x two equal to twenty and four x one plus three x two 70 00:08:46,190 --> 00:08:51,720 equal to twenty three if we give zero value for x three and x four 71 00:08:51,720 --> 00:08:57,140 it'll become three x one plus three x two equal to twenty one and four x one plus three 72 00:08:57,140 --> 00:09:04,570 x two equal to twenty four so we have to give some value for the two variables that we are 73 00:09:04,570 --> 00:09:11,410 not going to solve which are called fixed variables we have to give them some value 74 00:09:11,410 --> 00:09:18,030 now we can give any value to x three and x four except that we want x three and x four 75 00:09:18,030 --> 00:09:26,050 to be greater than or equal to zero therefore fixing x three and x four or fixing any two 76 00:09:26,050 --> 00:09:34,380 variables we can do it in infinite possible ways the easiest thing to do and perhaps the 77 00:09:34,380 --> 00:09:42,470 first thing we can try and do is to fix these variables at zero so what we are going to 78 00:09:42,470 --> 00:09:49,920 do is at any point we are going to solve for two variables by fixing two other variables 79 00:09:49,920 --> 00:09:59,910 to zero those variables that we are going to solve are called basic variables and those 80 00:09:59,910 --> 00:10:06,310 variables that we are going to fix to zero we are not going to solve for these they are 81 00:10:06,310 --> 00:10:23,710 called non basic variables now we have a total of four variables in this 82 00:10:23,710 --> 00:10:36,560 formulation that we have on the right hand corner so we have four variables in this formulation 83 00:10:36,560 --> 00:10:43,510 that we have there are four variables at any point i am going to solve only for two variables 84 00:10:43,510 --> 00:10:50,020 and i am going to fix some other two variables to zero so if i am going to solve for two 85 00:10:50,020 --> 00:10:56,920 variables out of four the two variables that i am going to solve can be chosen in four 86 00:10:56,920 --> 00:11:10,920 c two ways or they can be chosen in six ways so they can be chosen in four c two equal 87 00:11:10,920 --> 00:11:19,690 to six ways i can choose the variables now these six ways by which i can choose them 88 00:11:19,690 --> 00:11:27,830 are written here from one to six so one pair could be i am solving for x three and x four 89 00:11:27,830 --> 00:11:34,890 which means i am fixing x one x two to zero expanded through zero i can solve for x one 90 00:11:34,890 --> 00:11:43,000 x three by fixing x two and x four to zero i can solve for x one and x four by fixing 91 00:11:43,000 --> 00:11:51,270 x two x three to zero i can solve for x two and x three by fixing x one x four to zero 92 00:11:51,270 --> 00:11:57,950 i can solve for x two and x four by fixing x one x three to zero and i can solve for 93 00:11:57,950 --> 00:12:10,020 x one x two by fixing x three x four to zero so i can solve six problems i can choose two 94 00:12:10,020 --> 00:12:17,580 variables out of four in six ways four c two ways that have been shorn in this corner and 95 00:12:17,580 --> 00:12:27,610 i can solve the problem using these six pairs variables in each of these six problems there 96 00:12:27,610 --> 00:12:35,210 are two basic variables the variables that we are going to solve and we have the remaining 97 00:12:35,210 --> 00:12:44,700 two variables as non basic variables and we solve we we fix the non basic vary variables 98 00:12:44,700 --> 00:12:52,570 to zero so those variables that are fixed to zero are the non basic variables and those 99 00:12:52,570 --> 00:12:58,630 variables that we are going to solve are the basic variables 100 00:12:58,630 --> 00:13:05,640 now let us look at each one of these six solutions and see what happens when we actually solve 101 00:13:05,640 --> 00:13:15,920 them the first out of the six solutions we are going to solve for x three and x four 102 00:13:15,920 --> 00:13:31,380 and we are going to fix x one and x two at zero 103 00:13:31,380 --> 00:13:39,910 so when we solve for x three and x four we are fixing x one and x two to zero so i am 104 00:13:39,910 --> 00:13:46,430 just striking x one x two off now we can easily see that the solution is x three equal to 105 00:13:46,430 --> 00:13:53,420 twenty one x four equal to twenty four because x one x two are fixed at zero they are not 106 00:13:53,420 --> 00:13:59,410 going to contribute so we will have x three equal to twenty one x four equal to twenty 107 00:13:59,410 --> 00:14:17,080 four that is shown here as the first solution now we move to the second solution coming 108 00:14:17,080 --> 00:14:23,200 back to the first one we said we fixed x one x two to zero therefore we got the solution 109 00:14:23,200 --> 00:14:28,430 x three equal to twenty one x four equal to twenty four which is written here x three 110 00:14:28,430 --> 00:14:34,480 equal to twenty one x four equal to twenty four we now evaluate the objective function 111 00:14:34,480 --> 00:14:44,100 value for this because this solution is basic feasible so let me explain what a basic feasible 112 00:14:44,100 --> 00:14:51,110 solution is now this solution is basic because we have fixed x one x two two out of the four 113 00:14:51,110 --> 00:14:56,910 variables to zero and more importantly we are solving for two variables x three and 114 00:14:56,910 --> 00:15:03,750 x four so we are solving for x three and x four those variables are called basic variables 115 00:15:03,750 --> 00:15:10,660 non basic variables are fixed at zero we get a solution x three equal to twenty one x four 116 00:15:10,660 --> 00:15:18,230 equal to twenty four x one equal to zero x two equal to zero now this solution x one 117 00:15:18,230 --> 00:15:24,070 equal to zero x two equal to zero x three equal to twenty one x four equal to twenty 118 00:15:24,070 --> 00:15:30,640 four satisfies the non negativity restriction of x one x two x three x four greater than 119 00:15:30,640 --> 00:15:39,250 or equal to zero and also satisfies these two equations which are now the constraints 120 00:15:39,250 --> 00:15:47,320 because this solution satisfies all the constraint it becomes feasible because it satisfies all 121 00:15:47,320 --> 00:15:55,480 the constraints it becomes feasible and since it is a basic solution it becomes basic feasible 122 00:15:55,480 --> 00:16:04,580 so again a solution is basic when we solve for as many variables as the number of equations 123 00:16:04,580 --> 00:16:10,790 there are two equations two constraints we solve for two variables the basic variables 124 00:16:10,790 --> 00:16:18,540 here are x three and x four the non basic variables are set to zero x one and x two 125 00:16:18,540 --> 00:16:25,470 are set to zero so when we solve we get a solution x three equal to twenty one x four 126 00:16:25,470 --> 00:16:35,360 equal to twenty four now this is a basic solution and since this basic solution is also a feasible 127 00:16:35,360 --> 00:16:43,060 it satisfies this constraint this and the non negativity restriction it becomes a basic 128 00:16:43,060 --> 00:16:51,180 feasible solution once we have a basic feasible solution we find the value of the objective 129 00:16:51,180 --> 00:16:58,260 function the objective function is zero because both x one and x two are zero x three and 130 00:16:58,260 --> 00:17:04,620 x four do not contribute to the objective function so the value is ten into zero plus 131 00:17:04,620 --> 00:17:15,740 nine into zero which is zero we now move to the second of the six solutions 132 00:17:15,740 --> 00:17:33,210 we now move to the second of the six solutions now in this second solution 133 00:17:33,210 --> 00:17:41,710 we are going to solve for x one and x three by keeping x two and x four to zero since 134 00:17:41,710 --> 00:17:48,049 i am keeping x two and x four to zero i am writing these off x two and x four are not 135 00:17:48,049 --> 00:17:55,160 here so directly i get four x one equal to twenty four from the second equation that 136 00:17:55,160 --> 00:18:05,070 gives me x one equal to six and once i substitute x one equal to six three x one is eighteen 137 00:18:05,070 --> 00:18:12,450 therefore x three is equal to three so this basic solution where we are solving for two 138 00:18:12,450 --> 00:18:20,129 variables x one and x three fixing the remaining variables to zero gives us x one equal to 139 00:18:20,129 --> 00:18:30,509 six and x three equal to three this is also basic feasible because x two equal to zero 140 00:18:30,509 --> 00:18:37,389 x four equal to zero x one equal to six x three equal to three satisfies the non negativity 141 00:18:37,389 --> 00:18:44,289 restriction and therefore this is basic feasible now we evaluate the objective function value 142 00:18:44,289 --> 00:18:52,029 so x one equal to six x two equal to zero would give us ten x one plus nine x two equal 143 00:18:52,029 --> 00:18:59,590 to ten into six plus nine into zero which is sixty so we get the second solution which 144 00:18:59,590 --> 00:19:26,309 is here we now look at the third solution 145 00:19:26,309 --> 00:19:33,279 in the third solution we are going to solve for x one and x four so when we solve for 146 00:19:33,279 --> 00:19:41,409 x one and x four we have x two and x three equal to zero so x two and x three are now 147 00:19:41,409 --> 00:19:48,759 kept equal to zero so from the first equation we will get three x one equal to twenty one 148 00:19:48,759 --> 00:19:55,490 we get x one equal to seven so when we substitute x one equal to seven in the second equation 149 00:19:55,490 --> 00:20:02,740 we get twenty eight plus x four equal to twenty four x four is minus four and therefore this 150 00:20:02,740 --> 00:20:09,750 solution is infeasible and does not satisfy the non negativity restriction so we write 151 00:20:09,750 --> 00:20:14,830 it as infeasible and we do not evaluate the objective function 152 00:20:14,830 --> 00:20:25,900 we now go to the fourth one where we are going to solve for x two and x three we are going 153 00:20:25,900 --> 00:20:34,499 to solve for x two and x three so we will eliminate x one and x four here so we will 154 00:20:34,499 --> 00:20:42,090 eliminate x one and x four here so this would give us three x two equal to twenty four and 155 00:20:42,090 --> 00:20:49,610 then we would get x two equal to eight which is shown here now when we substitute x two 156 00:20:49,610 --> 00:20:56,419 equal to eight in the first equation we get twenty four plus x three equal to twenty one 157 00:20:56,419 --> 00:21:03,059 we get x three equal to minus three and this solution is infeasible because it violates 158 00:21:03,059 --> 00:21:09,210 the non negativity restriction we now move on to the fifth solution where 159 00:21:09,210 --> 00:21:20,539 we solve for x two and x four where we solve for x two and x four and therefore we will 160 00:21:20,539 --> 00:21:33,480 eliminate x one and x three we will eliminate x one and x three from the first equation 161 00:21:33,480 --> 00:21:40,090 we get three x two equal to twenty one so x two is equal to seven now we substitute 162 00:21:40,090 --> 00:21:45,919 in the second equation seven into three twenty one plus three equal to twenty four x four 163 00:21:45,919 --> 00:21:53,259 equal to three so this is basic feasible because it satisfies the non negativity restriction 164 00:21:53,259 --> 00:21:58,929 the value of the objective function is nine into seven which is sixty three 165 00:21:58,929 --> 00:22:05,789 the six and the last one is we solve for x one and x two here by eliminating x three 166 00:22:05,789 --> 00:22:12,970 and x four so we solve for x one and x two by eliminating x three and x four and when 167 00:22:12,970 --> 00:22:17,899 we solve for three x one plus three x two equal to twenty one four x one plus three 168 00:22:17,899 --> 00:22:24,570 x two equal to twenty four we get a solution x one equal to three x two equal to four which 169 00:22:24,570 --> 00:22:31,100 is also a basic feasible so we evaluate the objective function to get sixty six which 170 00:22:31,100 --> 00:22:38,840 is shown here and sixty six is the best solution that we have out of the basic feasible solutions 171 00:22:38,840 --> 00:22:44,549 and hence is the optimum solution to this problem 172 00:22:44,549 --> 00:22:51,059 in the next class we will revisit this algebraic method and we will try to get more insights 173 00:22:51,059 --> 00:22:53,000 into the algebraic method