I am familiar with the 1D implicit method which solves the heat equation with homogeneous Dirichlet conditions, $$u_i^{k-1} = \big(1+2\lambda)u_i^k - \lambda \big( u_{i+1}^k + u_{i-1}^k \big) $$ which can be rearranged in to a linear system $$\underline{u} ^{k-1} = A \underline{u} ^{k}$$ where $$A = \begin{pmatrix} 1+2\lambda & -\lambda & 0 & \dots & 0\\ -\lambda & 1+2\lambda & -\lambda & \ddots & \vdots\\ 0 & -\lambda & \ddots & \ddots & 0\\ \vdots & \ddots & \ddots & \ddots & -\lambda\\ 0 & \dots & 0 & -\lambda & 1+2\lambda\\ \end{pmatrix}.$$ However, I am becoming increasingly confused about what the linear system for the 2 Dimensional case would look like. I am aware that the so called algorithm would now be, $$ u_{i,j}^{k-1} = \big(1+4\lambda)u_{i,j}^k - \lambda \big( u_{i+1,j}^k + u_{i-1,j}^k + u_{i,j+1}^k + u_{i,j-1}^k \big). $$ $\textbf{My question - What is the linear system for this algorithm?}$
I know that it can have the same format as the 1D case but I'm unsure what the vector $\underline{u}$ would be since there are now two different spatial dimensions. (i.e we have both $i$ and $j$ varying). I am also unsure of what the coefficient matrix would be. Thanks in advanced for any help.
Warning : this answer may be overkill for your purposes and have an intimidating abstraction level where we would do well to be equipped with (at least) the background knowledge equivalent to a well digested Honors linear-algebra course.
As long as you use a lexical ordering you can be systematic and use Kronecker products with identity matrices in expressing linearly separable equations.
Scalar products can calculate the index of a lexical order. If you excuse the perhaps confusing notation. For two dimensions of your named indices $i$ and $j$ :
$(i,j) \in \{0,\cdots,N_i-1\}\times\{0,\cdots,N_j-1\} \to [i,j] \cdot [1,N_i]^T$
Now in the general case of dimensionality $\geq 3$ the vector to the right would have element 3 = $N_i\cdot N_j$ systematically multiplying up the number of elements of previously passed dimensions. In matlab this would be a "cumprod" operation on the size vector padded with a $1$ at the start.
The nice thing with being systematic like this is that we easily can switch between (i,j) and vectorized index.
Now separable linear operators for such lexical orders are nice to express with Kronecker products.
for operator in the 1 dimensional case represented by matrix $M$:
along i dimension :
$M\otimes I_{N_j}$
along j dimension :
$I_{N_i}\otimes M$
The nice thing here is that with increasing dimensions we can just systematically stack identity matrices and operator matrices as factors where they belong in the Kronecker product.