Lets consider complete graph $K_{4}$ and one of its vertices $a$. $A$ is adjacency matrix of $K_{4}$
The length of a path is a number of how many times we crossed some edge.
I call special path if it has length equal to $4$
How many there are closed special paths including $a$ in $K_{4}$?
I am asking because i wrote by hand all the possibilities and i get $13$ but on the other hand using knowledge from link below all the values of a $A^{4}$ on main diagonal equal to $21$. A contradiction.
https://en.wikipedia.org/wiki/Adjacency_matrix
I am looking for someone who explain me how it schould work.
Here's where the $21$ paths (or walks) come from. You can compare to your work to see where the difference lies. If we start at vertex $a$ and go to $b$, we can either proceed to a third vertex $c\neq a$ or we can return to $a$. In the second case, the only way to get back to $a$ in two steps is to go to some vertex $d$ and then return to $a$. We have $3$ choices for $b$ and $3$ for $d$, so there are $9$ paths of this type.
In the second case (where we have gone $a-b-c$) we again gave two choices: we can return to $b$ or we can go the the fourth vertex $d$. In either case, we have then to return to $a$. Reasoning as above, we see that there $6$ paths of each of these types, and $$9+6+6=21$$ paths in all.
Note that not all of these paths pass through every vertex, so we are only counting the closed walks of length $4$ that pass through $a$.