# why fft2 of a hermitian matrix gives complex result

for a Hermitian matrix
$$A = \left[\begin{array}{ccc}2& 2+i& 4\\ 2-i& 3& i\\ 4& -i& 1\end{array}\right]$$
the result of matlab fft2(A) is a complex matrix instead of a real matrix

this post shows how to handle it for 1D matrix
https://blogs.mathworks.com/steve/2010/07/16/complex-surprises-from-fft/

but how to apply it to 2D matrix?

Or can I just use numpy command hfft2?

The matrix is hermitian yes, but the signal is assumed to exist on a 2D discretized grid representing a function. And hermitian matrix means something different than hermitian function.

With overline meaning complex conjugate. For functions of two variables the hermitean property gives : $$f(x,y) = \overline {f(-x,-y)}$$

For example in the language if you write

 fftshift(fftshift(fft2(rand(3)),1),2)


you will get the 2D Fourier transform of a real valued random function uniform on $[0,1]$ sampled in three spots, -x,0,+x and -y,0,+y respectively.

The result is: $$\left[\begin{array}{ccc} -0.0273+0.0188i&-0.7306-0.2549i&0.7398+0.2131i\\ -1.4214+0.2657i&4.5929+0i&-1.4214-0.2657i\\ 0.7398-0.2131i&-0.7306+0.2549i&-0.0273-0.0188i \end{array}\right]$$

And you can see for yourself which real and imaginary parts match up and how the sign changes.