Clear[u];Clear[A];Clear[B];Clear[a];Clear[b]

Start by clearing variables and setting initial conditions.

Do[u[0,j]:=0,{j,0,10,1}]

Do[u[0,j]:=1,{j,4,6,1}]

Now fix the boundary conditions.

Do[u[n,0]:=0,{n,1,10}]

Do[u[n,10]:=0,{n,1,10}]

Check to make sure that the initial conditions are set correctly.

t=Table[u[0,j],{j,0,10}]

U[0]=Table[u[0,j],{j,1,9}]

Set the size of the parameter s.

s=2

0.2

Enter the matrix A in the implicit (backward difference) scheme.

A=Array[a,{9,9}]

Do[Do[a[k,j]=0,{k,1,9}],{j,1,9}]

Do[a[j,j]=(1+2*s),{j,1,9}];Do[a[j,j+1]=-s,{j,1,8}];Do[a[j+1,j]=-s,{j,1,8}]

A

MatrixForm[A]

AA=Inverse[A]

Do[U[m+1]=AA.U[m],{m,0,10}]

Check (and plot) the value at n=3.

U[3]

ListPlot[U[3],Joined->True,PlotRange->{{0,10},{0,1}}]

Check and plot the value at n=10.

U[10]

ListPlot[U[10],Joined->True,PlotRange->{{0,10},{0,1}}]