Max 4x + 2y subj to
10 x + 5y <= 50
12 x + y <= 48
3x + 2y <= 18
x, y >= 0

Graphical Solution

1. Find feasible region
2. Find corner points
3. Eval function at corner points to find max

To find the feasible region, we can use the RegionPlot function

RegionPlot[10x+5y≤50 &&
                     12x +y ≤ 48 &&
                       3x + 2y ≤ 18 &&
                         x ≥ 0 && y ≥ 0,
                         {x,-0.1,4.5},{y,-0.1,10}]

Solve[{12x+y==48,10x+5y==50},{x,y}]

N[{{x->(19/5),y->(12/5)}}]

Solve[{3x+2y==18,10x+5y==50},{x,y}]

We found all the corner points of the feasible set so we can find the max:

P[x_,y_]:= 4x + 2y

P[0,0]
P[0,9]
P[2,6]
P[3.8,2.4]
P[4,0]

Thus, max is 20 and occurs at [2,6] and [3.8, 2.4]

Now using Simplex Method

1. Setup matrix
2. Pivot like there is no tomorrow

A={{10,5,1,0,0,0,50},
     {12,1,0,1,0,0,48},
     {  3,2,0,0,1,0,18},
     {-4,-2,0,0,0,1,0}}

A // MatrixForm

Note: to use the legic row (and col) operations, we need to know the “Parts” function, which is abbreviated by [[ ... ]]. To access parts of a matrix:  

   A[[n]] stands for the entire n-th row
   A[[All,m]] stands for the entire m-th column
   A[[n,m]] is the element at row n, column n
   A[[n;;m]] are rows n to m
   
   Now we can go: pivot element is in colum 1 (smallest value in bottom row) and row 2 (smallest ratio of last column by column 1). We turn that into 1:

A[[2]]=A[[2]]/ 12

A // MatrixForm

Now we will “pivot”:

A[[1]]=A[[1]]+ A[[2]]*(-10);
A[[3]]=A[[3]]+ A[[2]]*(-3);
A[[4]] = A[[4]]+ A[[2]]*4;
A // MatrixForm

The new pivot element is in row 2, column 1. We turn that to 1 and the remaining numbers in that column to 0

A[[1]] = A[[1]] / (25/6);
A //MatrixForm

A[[2]]=A[[2]]+A[[1]]*(-1/12);
A[[3]]=A[[3]]+A[[1]]*(-7/4);
A[[4]]=A[[4]]+A[[1]]*(5/3);
A // MatrixForm

and there’s the answer (since bottom row is non-negative): x = 19/5, y = 12/5, max is 20.

New Problem: Max x + 2y subject to
     x + y <= 6
     x + 1/2 y <= 4
     x, y >= 0
    
1. Draw feasible set:

RegionPlot[x+y≤ 6 && x + 0.5 y ≤ 4 && x ≥ 0 && y ≥ 0,{x,-0.1,6},{y,-0.1,6}]

P[x_,y_]:= x + 2y

Solve[{x+y==6,x+0.5y == 4},{x,y}]

P[0,0]
P[0,6]
P[2,4]
P[4,0]

Thus, max is 12 at (0, 6). 

Using Simplex method, we get:

A={{1,1,1,0,0,6},{1,0.5,0,1,0,4},{-1,-2,0,0,1,0}}

A // MatrixForm

A[[2]]=A[[2]] + A[[1]]* (-0.5)

A[[3]]=A[[3]] + A[[1]] * 2

A // MatrixForm

Done: x = 6, y = 0, max = 12

Next: we want to automate the pivot process and indeed the whole process. For example, assume pivot element is in row r, column c

A[[r]] = A[[r]] / A[[r,c]]
A[[1]] = A[[1]] + A[[r]] * (-A[[1,c]])
...
A[[n]] = A[[n]] + A[[r]] * (-A[[n,c]])

which we can easily automate once we have discovered this pattern.