Q:

Confirming the existence of a function related to a matrix

Is it possible to get an answer to the following question in Mathematica? 
Let $M$ be a $n$ by $n$ matrix, is there a function $m:\mathbb{N}\times \mathbb{N}\rightarrow \mathbb{Z}$ such that $m_{ij}=m_{ji}$ and $m_{ij}=m_{i+2,j+2}$ for all $i$ and $j$.
I am new to Mathematica  and interested whether such existential, abstract expressions can be solved in Mathematica.

A:

The good thing about programming with Mathematica is that you can move from conceptual problems like the one described to getting a solution pretty easily. Since you're new to Mathematica, let's walk this through step by step:

1. Let $M$ be an $n\times n$ matrix

This one's easy:
ℳ[n_Integer] := Array[m, {n, n}]
ℳ[5] // MatrixForm

2. A function $m:\ \mathbb{N}\times\mathbb{N}\to \mathbb{Z}$ such that $m_{ij}=m_{ji}$

In other words, we don't care about the order $i,j$ or $j,i$ — we can achieve this simply by making m have the attribute Orderless.
SetAttributes[m, Orderless]
ℳ[5] // MatrixForm

Compare this output with the one above.

3. A function $m:\ \mathbb{N}\times\mathbb{N}\to \mathbb{Z}$ such that $m_{ij}=m_{i+2,j+2}$

Here, we can use RSolve to solve for the relation m[i,j] == m[i+2,j+2]:
RSolve[m[i, j] == m[2 + i, 2 + j], m[i, j], {i, j}]
(* {{m[i, j] -> C[1][-2 i + 2 j] + (-1)^i C[2][-2 i + 2 j]}} *)

What this solution says is that $m$ can be a function of the form 
$$m: (i,j)\mapsto C_1(i,j) +(-1)^iC_2(i,j)$$
where the $C_i$ are constant functions (C denotes a constant in Mathematica).
Now putting all of these together, we can do:
Block[{m, p, q},
    SetAttributes[m, Orderless];
    m[i_, j_] := p + (-1)^i q;
    ℳ[5]
] // MatrixForm

where p and q are constants you can choose.

