How to show that order of an element is $2$ where the element is $ p-1$ for prime $p$. Question is that we have an element $a$, where $a = p-1$ and $p$ is a prime number, and I need to prove that order of $a$ is $2$. 
I know how do we calculate order of an element where we know exact number of elements in a group but I do not understand how do we prove it if we don't know the exact value of $p$.
 A: I am going to assume that you are in the group $\mathbb{Z}/p\mathbb{Z}$, and that $p$ is odd.
Now $(p-1)^2 = p^2 - 2p + 1 = 1 \pmod p$, so the order of $p-1$ is indeed $2$.
A: There is a prime number.  We aren't going to be specific, so we are going to call it $p$.  We choose to work in the integers modulo $p$ with multiplication as the operation.  In the integers modulo $p$, there is an element $a$ congruent to $p-1$ modulo $p$.  We ask you to show that the order of $a$ is $2$.
To show that the order of an element, $x$, is $n$, we compute $x^n$ and determine whether that number is the identity of the group.  We also check $x^d$ for all divisors $d$ of $n$ to be certain that the order of $x$ is not actually smaller than $n$.
To determine whether $a$ has order $2$, we must compute 
$$  a^2 = (p-1)^2 \pmod{p}  $$
and determine that the result is the identity in the chosen group.  We should still check the divisors of $2$.  (In this problem, this check ensures that we don't accidentally claim that the order of the identity is bigger than $1$ if it happens to be that $a$ is the identity.  Spoiler: this happens in this problem for only one choice of $p$.)
A: I assume
$p \ne 2 \tag 0$
in accord with the comment of J. W. Tanner to the question itself.   
In $\Bbb Z_p$, if
$a \equiv p - 1 \mod p, \tag 1$
then
$a^2 = p^2 - 2p + 1 \equiv 1 \mod p; \tag 2$
the order of $a$ is thus $2$ in $\Bbb Z_p$.
Note that (0) and (1) preclude 
$a \equiv 1 \mod p. \tag 3$
A: Hint:
$p-1\equiv -1\pmod p,$
so $(p-1)^2\equiv(-1)^2=1\pmod p$
