A possibility to give a sense of the matrix $M$ is sage is as follows. Consider the field $F=\Bbb F_{13}$ with $13$ elements. The number $7$, seen as an element of this field, is not a square.
sage: F = GF(13)
sage: F(7).is_square()
False
So in order to have the element $5+\sqrt 7$, we have to construct the field extension $L=\Bbb F_{169}$, pick some element $A\in L$, with $A^2=7$, and consider the matrix $M$ with entries $5+A$, $0$, $0$, $5-A$.
We have:
F = GF(13)
R.<x> = PolynomialRing(F)
L = GF(13^2)
A = [A for A in L if A^2 == 7][0]
M = matrix(L, 2, 2, [5 + A, 0, 0, 5 - A])
print(f"M has multiplicative order {M.multiplicative_order()}")
And we obtain:
M has multiplicative order 56
sage: M^56
[1 0]
[0 1]
sage:
Also:
sage: (5 + A).multiplicative_order()
56
sage: (5 - A).multiplicative_order()
56
So $M$ has order $56$ seen as an element of $GL(2, L)$, in particular, its order in $PGL(2,L)$ is a divisor of $56$.
Let us compute the powers of $M$ for all divisors of $56$, this is the same as doing so only for the conjugated numbers $5\pm A$ in $L$:
sage: [(d, (5-A)^d) for d in 56.divisors()]
[(1, 10*z2),
(2, 9*z2 + 8),
(4, 4*z2 + 6),
(7, 5*z2 + 4),
(8, 12*z2 + 4),
(14, 5),
(28, 12),
(56, 1)]
sage:
It is clear now, that $M^{14}$ acts as a scalar, so it is an element of the center $Z$ of $GL(2,L)$, so $M$ seen as an element of $PGL(2,L)=GL(2,L)/Z$ is the identity. (And for no divisor of $14$ "the same" happens.)
sage: M^14
[5 0]
[0 5]
Note: It is strange, but the code
F = GF(13)
R.<x> = PolynomialRing(F)
L.<a> = GF(13^2, modulus=x^2-7)
M = matrix(L, 2, 2, [5 + a, 0, 0, 5 - a])
delivers a false multiplicative order $168$ for $M$, however the right order $56$ for $(5\pm a)$.
sage: M
[ a + 5 0]
[ 0 12*a + 5]
sage: M.multiplicative_order()
168
sage: M^56
[9 0]
[0 9]
sage: (5 + a)^56
1
sage: (5 + a).multiplicative_order()
56
sage: M^2
[11*a + 10 0]
[ 0 4*a + 10]
sage: (5 + a)^2
10*a + 6
This is the reason for the rather cumbersome introduction of $A$ and $L$ in the "good part of the answer".
Maybe I'm misunderstanding, but 7 does not have a square root mod 13. There is a second problem, which is that Sage constructs
PGL(n, p)
as a permutation group, not a matrix group, so I don't see an obvious way to produce an element of this group from a given matrix.See https://github.com/sagemath/sage/issu...