Shorter way for writing expression

189 Views Asked by At

I'm writing the following expression in a long expression

$$ \left( 1+(-1)^m+(-1)^n+(-1)^{m+n}\right), $$ for integer $m,\ n$. This equals $4$ if both $m$ and $n$ are even, and equals $0$ otherwise. I am writing this in a long expression, which makes that this awkward term breaks the line, while if I could make it a bit shorter, it would fit. Is there a way I'm overseeing, to write this expressin shorter?

I've thought of writing it as $F(m,n)$, where

$$ F(m,n)=\begin{cases} 4 \text{ if }m ,\ n\text{ even}\\ 0 \text{ otherwise} \end{cases} $$ But I would like to avoid having to introduce a new function in an expression which is already long and difficult to understand.

2

There are 2 best solutions below

3
On BEST ANSWER

Why not $(1+(-1)^m)(1+(-1)^n)$? Or since we're limited to integers, $(-1)^m=\cos\pi m\implies 1+(-1)^m=2\cos^2\frac{\pi m}{2}$, so you could use $4\cos^2\frac{\pi m}{2}\cos^2\frac{\pi n}{2}$. Finally, with Iverson brackets you could write $4[2|m][2|n]$, $4[2|m\land 2|n]$ or $4\left[2|\left(m,\,n\right)\right]$.

3
On

Another option would be $$2-2(-1)^{(m-1)(n-1)}$$