Number of solution to $x^2 + y^2 + z^2 = t$ in a finite field suppose I have a finite field $\mathbb{F}_q$, where $q = p^m$ and $p$ is 
prime. Let $0 \not = t \in \mathbb{F}_q$. I was wondering
if someone could tell me what the number of solution to
$$
x^2 + y^2 + z^2 = t
$$
would be (where $x,y,z \in \mathbb{F}_q$)? In particular is there always a solution?
I would appreciate any reference also.
Thanks!
 A: In a finite field of odd characteristic, it is well known that every element is a sum of two squares. In a finite field of characteristic $2,$ the multiplicative group is cyclic of odd order, and every non-zero element is a square. Hence there is always at least  one solution to the problem in which $z = 0.$
 To see the proof in the odd characteristic, note that the elements of the field which are sums of two squares are closed under multiplication, because of the formula
$(ad-bc)^{2} + (ac+bd)^{2} = (a^{2}+b^{2})(c^{2}+d^{2}).$ Furthermore, not every element of the field is a square, since the multiplicative group is cyclic of order $q-1$ and there are $\frac{q-1}{2}$ non-zero squares.
 I claim that the set of squares in the field is not closed under addition. If it were, the total number of squares would be a divisor of $q,$ the order of the additive group of the field. Hence it would be a power of $p.$ On the other hand, the total number of squares in the field is $\frac{q+1}{2},$ which is not divisible by $p.$ Hence, somewhere is the field, we can find two squares whose sum is a non-square, so the number of non-zero elements which are sums of two squares is greater than $\frac{q-1}{2}$. On the other hand, this number, being the order of a multiplicative subgroup of the group of non-zero elements, is a divisor of $q-1.$ Hence there must be $q-1$ non-zero elements which are the sum of two squares, so all elements of the field are sums of two squares.
