What is $A^2$ when $A$ is $m \times n$ matrix? 
*

*How can one raise a matrix by the power on $n$? i.e. $A^n$ where $A \in \mathbb{R}^{p \times q}$ and $n \in \mathbb{R}$


Is it defined as $A^n = AA^TAA^T...$ $n$ times? Holds for non-square matrices but I cannot find any source for it.
Is it defined as $A^n = AAAA...$ $n$ times? As showed here? But this only holds if $A$ is a square matrix.
 A: An $a\times b$ matrix can be multiplied by a $c\times d$ matrix if and only if $b=c$. The product is an $a\times d$ matrix. I always draw this “inner-outer” diagram:
$$[\underbrace{a\times \overbrace{b] \times [c}^{\text{match}} \times d}_{\text{product}}]$$
So say $\boldsymbol{A}\in\Bbb{R}^{r\times c}$, meaning $\boldsymbol{A}$ is an $r\times c$ matrix (with real entries).
Then $\boldsymbol{A}^2$ exists if and only if $r=c$. The resultant is another $r\times c$ matrix, which we know must be square since $r$ must equal $c$. This can again and again be multiplied by an $r × c = r × r = c × c$ matrix.

To be more explicit:

$$\boldsymbol{A}
= \left[ \begin{matrix}
A(1,1) & A(1,2) & \cdots & A(1,c) \\[2ex]
A(2,1) & A(2,2) & \cdots & A(2,c) \\[2ex]
\vdots & \vdots & \ddots & \vdots \\[2ex]
A(r,1) & A(r,2) & \cdots & A(r,c) \\[2ex]
\end{matrix} \right]$$
$$
\boldsymbol{A}^2
= 
\left[ \begin{matrix}
A(1,1) & A(1,2) & \cdots & A(1,m) \\[2ex]
A(2,1) & A(2,2) & \cdots & A(2,m) \\[2ex]
\vdots & \vdots & \ddots & \vdots \\[2ex]
A(m,1) & A(m,2) & \cdots & A(m,m) \\[2ex]
\end{matrix} \right]
\left[ \begin{matrix}
A(1,1) & A(1,2) & \cdots & A(1,m) \\[2ex]
A(2,1) & A(2,2) & \cdots & A(2,m) \\[2ex]
\vdots & \vdots & \ddots & \vdots \\[2ex]
A(m,1) & A(m,2) & \cdots & A(m,m) \\[2ex]
\end{matrix} \right]
=
\left[ \begin{matrix}
B(1,1) & B(1,2) & \cdots & B(1,m) \\[2ex]
B(2,1) & B(2,2) & \cdots & B(2,m) \\[2ex]
\vdots & \vdots & \ddots & \vdots \\[2ex]
B(m,1) & B(m,2) & \cdots & B(m,m) \\[2ex]
\end{matrix} \right]$$
$$\bbox[yellow,5px]{B(x,y) = \sum_{k=1}^{m}A(x,k) \, A(k,y)}$$

