Using this paper as a reference (Section IV.C, page 4318), We have the following objective function which we wish to minimize with respect to $D \in \mathbb R^{n \times K}$ ($X \in \mathbb R^{K \times N}$):
$$\min_{D} \{||Y-DX||_F^2\} \quad \text{subject to} \quad ||X||_0 \leq T_0$$
Which could be simplified as follow:
\begin{align} &\|Y-DX\|_F^2 \tag{1} \\ &\qquad = \left\|Y-\sum_{j=1}^K d_jx_T^j\right\|_F^2 \tag{2} \\ &\qquad =\left\|\big(Y-\sum_{j \neq k} d_jx_T^j\big)-d_kx_T^k\right\|_F^2 \tag{3} \\ &\qquad = \left\|E_k-d_kx_k^T\right\|_F^2 \tag{4} \end{align}
I'd like to make sure that I understand how we get $(4)$ from $(1)$.
Decomposing the multiplication $DX$ to the sum in $(2)$ is a matrix multiplication, right? The way I learned it, when you multiply two matrices, rows of the first matrix is multiplied by column of the second one. But what I see in the above formula is quite different. Then I guessed perhaps it gets the multiplication entries one by one, but how do we separate the kth column of $D$ multiplied by its corresponding row in $X$ ($d_kx_T^k$)? Please explain the simplification process in details because I need to understand it to be able to understand the whole topic of the above mentioned paper.
Note that even though it looks confusing the sum is just the matrix multiplication: Vectors are multiplied with transposed vectors, resulting in a matrix. Those matrices are added. The result is the same as if you do the multiplication as usual. Example:
$$A = \Big(\matrix{a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33}}\Big) $$ $$B = \Big(\matrix{b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23} \\ b_{31} & b_{32} & b_{33}}\Big) $$
Then $a_1b_T^1 = \Big(\matrix{a_{11} \\ a_{21} \\ a_{31}}\Big) \Big(\matrix{b_{11} & b_{12} & b_{13}}\Big) = \Big(\matrix{a_{11}b_{11} & a_{11}b_{12} & a_{11}b_{13} \\ a_{21}b_{21} & a_{21}b_{22} & a_{21}b_{23} \\ a_{31}b_{31} & a_{31}b_{32} & a_{31}b_{33}}\Big)$.
The middle step should be clear, just one term in the sum is extracted.