(*Input data*)
A={{4,-2,1},{-2,4,-2},{1,-2,4}};
b={11,-16,17};
n=Length[A];
(*Forward elimination*)
For[k=1, k≤n, k++,
For[i=k+1,i≤n,i++,
l=((A[[i,k]])/(A[[k,k]]));
A[[i,k]]=0;
For[j=k+1,j≤n,j++,
A[[i,j]]=A[[i,j]]-l*A[[k,j]];
];
b[[i]]=b[[i]]-l*b[[k]];
]
]
(*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