Let $ p $ be a prime number and \begin{align} K=\left\{ \begin{pmatrix} a &b \\ c& d \end{pmatrix} \mid a,b,c,d \in \left\{0,1,\ldots,p-1 \right\}, \right. & a+d \equiv 1 \!\!\!\! \pmod p, \\ & ad-bc \equiv 0 \!\!\!\! \pmod p \left.\vphantom{\begin{pmatrix} a &b \\ c& d \end{pmatrix}} \right\}. \end{align} Determine $\operatorname{card}(K) $.
I have taken some particular cases: $ p=2,3,5 \text{ or } 7 $ and I've deduced that $\operatorname{card}(K)=p(p+1) $, but I can't extend the solution to the general case.
Here's one way to count them. Note that any such matrix can be built by one of the two following methods:
Method 1:
Note that there are $p(p-1)$ matrices that we get from this method.
Method 2:
There are exactly $2p$ matrices that we get from this method.
In total, we thus have $p(p-1) + 2p = p(p+1)$ such matrices.