Given $$ A = \begin{bmatrix}1 & 0 \\0 & 1 \\1 & 0 \end{bmatrix}, b = \begin{bmatrix} 2 \\ 4 \\ 100 \end{bmatrix} $$
Trying to calculate x for Ax = b
$$ Ax = b \Longleftrightarrow A^{T}Ax = A^{T}b \Longleftrightarrow x = (A^{T}A)^{-1}A^{T}b $$
$$ A^{T}A = \begin{bmatrix}1 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix} \cdot \begin{bmatrix}1 & 0 \\0 & 1 \\1 & 0 \end{bmatrix} = \begin{bmatrix}2 & 0 \\ 0 & 1 \end{bmatrix} $$
$$ (A^{T}A)^{-1} = \begin{bmatrix} 1/2 & 0 \\ 0 & 1 \end{bmatrix} $$
$$ (A^{T}A)^{-1}A^{T} = \begin{bmatrix} 1/2 & 0 \\ 0 & 1 \end{bmatrix} \cdot \begin{bmatrix}1 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix} = \begin{bmatrix}1/2 & 0 & 1/2 \\ 0 & 1 & 0 \end{bmatrix}$$
$$ \therefore x = \begin{bmatrix}1/2 & 0 & 1/2 \\ 0 & 1 & 0 \end{bmatrix} \cdot \begin{bmatrix} 2 \\ 4 \\ 100 \end{bmatrix} = \begin{bmatrix} 51 \\ 4 \end{bmatrix}$$
substituting x in Ax and calculating Ax gives
$$ Ax = \begin{bmatrix}1 & 0 \\0 & 1 \\1 & 0 \end{bmatrix} \cdot \begin{bmatrix} 51 \\ 4 \end{bmatrix} = \begin{bmatrix} 51 \\ 4 \\ 51 \end{bmatrix} \ne b$$
How come matrix calculations didn't give any inconsistency as there is no solution for x in Ax=b
I understand that $\begin{bmatrix} 51 \\ 4 \\ 51 \end{bmatrix}$ is projection of b in column space of A
updated:
$Ax = b \implies A^{T}Ax = A^{T}b \implies x = (A^{T}A)^{-1}A^{T}b $ to $ Ax = b \Longleftrightarrow A^{T}Ax = A^{T}b \Longleftrightarrow x = (A^{T}A)^{-1}A^{T}b $
The arrows in $$ Ax = b \implies A^{T}Ax = A^{T}b \implies x = (A^{T}A)^{-1}A^{T}b $$ point from left to right, but not from right to left. In particular, the first step is not necessarily reversible (for example when all entries in $A$ are $0$).