Clear[a,x]
n=101;
a=Table[0.0,{i,1,n},{j,1,n}];
b=Table[0.0,{i,1,n}];
Do[a[[i,i-1]]=-0.5;a[[i,i+1]]=-0.5;a[[i,i]]=1.,{i,2,n-1}];
a[[1,1]]=1.; a[[n,n]]=1.0;
b[[1]]=1.0;
MatrixForm[a];
MatrixForm[b];

x=Table[xx[i],{i,1,n}];
Det[a];
sys=Thread[Dot[a,x]==b];
xsol=x/.Solve[sys,x][[1]]//N

d=Diagonal[a]*IdentityMatrix[n];
r=a-d;
l=u=Table[0,{i,1,n},{j,1,n}];
Do[l[[i,j]]=-a[[i,j]],{i,2,n},{j,1,i-1}]
Do[u[[i,j]]=-a[[i,j]],{i,1,n-1},{j,i+1,n}]
MatrixForm[d];
MatrixForm[l];
MatrixForm[u];
tJ=-Dot[Inverse[d],r];
cJ=Dot[Inverse[d],b];
λJ=Eigenvalues[tJ]//N;
ρJ=Max[Abs[λJ]]
tGS=Dot[Inverse[d-l],u];
cGS=Dot[Inverse[d-l],b];
λGS=Eigenvalues[tGS]//N;
ρGS=Max[Abs[λGS]]
ω0=2.0/(1.0+Sqrt[1.0-ρJ^2])

ω=ω0;
tSOR=Dot[Inverse[d-ω*l],ω*u+(1-ω)*d];
cSOR=Dot[ω*Inverse[d-ω*l],b];
λSOR=Eigenvalues[tSOR]//N;
ρSOR=Max[Abs[λSOR]]

t=tJ;
c=cJ;
kmax=20000;tol=1.0 10^(-6);
k=0;xk[0]=Table[0.0,{i,1,n}];
While[k<kmax,
xk[k+1]=Dot[t,xk[k]]+c;
norm=Max[Abs[xk[k+1]-xk[k]]];If[norm≤tol,Break[]];
k++]
Print[k,"  ",xk[k]]

t=tGS;
c=cGS;
kmax=20000;
k=0;xk[0]=Table[0.0,{i,1,n}];
While[k<kmax,
xk[k+1]=Dot[t,xk[k]]+c;
norm=Max[Abs[xk[k+1]-xk[k]]];If[norm≤tol,Break[]];
k++]
Print[k,"  ",xk[k]]

t=tSOR;
c=cSOR;
kmax=10000;
k=0;xk[0]=Table[0.0,{i,1,n}];
While[k<kmax,
xk[k+1]=Dot[t,xk[k]]+c;
norm=Max[Abs[xk[k+1]-xk[k]]];If[norm≤tol,Break[]];
k++]
Print[k,"  ",xk[k]]