Clear[α,a,x,xx]

α=0.45;

n=10;

rule=Table[p[i]->0.0,{i,1,n-1}];
sys=Table[(p[i]-(α*p[i-1]+(1-α)*p[i+1])==0.)/.{p[0]->1.,p[n]->0.},{i,1,n-1}];
a=Table[Coefficient[sys[[i]][[1]],p[j]],{i,1,n-1},{j,1,n-1}];
b=Table[-sys[[i,1]]/.rule,{i,1,n-1}];
MatrixForm[a]
MatrixForm[b];

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

d=Diagonal[a]*IdentityMatrix[n-1];
r=a-d;
l=u=Table[0,{i,1,n-1},{j,1,n-1}];
Do[l[[i,j]]=-a[[i,j]],{i,2,n-1},{j,1,i-1}]
Do[u[[i,j]]=-a[[i,j]],{i,1,n-2},{j,i+1,n-1}]
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=40000;tol=1.0 10^(-6);
k=0;xk[0]=Table[0.0,{i,1,n-1}];
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-1}];
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-1}];
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]]

(* Stesso con Gauss-Jordan *)

Clear[a,b,x,n];
n=10;
rule=Table[p[i]->0.0,{i,1,n-1}];
sys=Table[(p[i]-(α*p[i-1]+(1-α)*p[i+1])==0.)/.{p[0]->1.,p[n]->0.},{i,1,n-1}];
a=Table[Coefficient[sys[[i]][[1]],p[j]],{i,1,n-1},{j,1,n-1}];
b=Table[-sys[[i,1]]/.rule,{i,1,n-1}];
x=Table[xx[i],{i,1,n-1}];
sys1=Thread[Dot[a,x]==b];
xsol=x/.Solve[sys1,x][[1]]//N

MatrixForm[a]
MatrixForm[b]

Clear[ab,x];
ab=Table[Join[a[[i]],{b[[i]]}],{i,1,n-1}];
MatrixForm[ab]

Do[piv=ab[[i]][[i]];Print["i = ", i, "  piv = ", piv];Do[m[j]=ab[[j]][[i]]/piv;ab[[j]]=ab[[j]]-m[j]*ab[[i]],{j,i+1,n-1}],{i,1,n-2}];
MatrixForm[ab]

xx[n-1]=ab[[n-1,n]]/ab[[n-1,n-1]];
Do[xx[i]=(ab[[i,n]]-Sum[xx[j]*ab[[i,j]],{j,i+1,n-1}])/ab[[i,i]],{i,n-1,1,-1}];
x=Table[xx[i],{i,1,n-1}];
MatrixForm[x]