(*Input data*)
A={{4,-2,1},{-2,4,-2},{1,-2,4}};
b={11,-16,17};
n=Length[A];
(*Forward elimination*)
For[i=1, i≤n, i++,
For[j=i+1,j≤n,j++,
l=((A[[j,i]])/(A[[i,i]]));
A[[j,i]]=0;
For[k=i+1,k≤n,k++,
A[[j,k]]=A[[j,k]]-l*A[[i,k]];
];
b[[j]]=b[[j]]-l*b[[i]];
]
]
(*Backward substitution*)
x=Table[0,{i,n}] ;(*We create a list, in which we shall keep the values of the unknowns*)
For[i=n,i≥1, i--,
x[[i]]=((b[[i]]-Sum[A[[i,j]]x[[j]],{j,i+1,n}])/(A[[i,i]]))

]
x