# Scaling factor of Discrete Fourier Transform [duplicate]

I am going through DFT basics. I found somwhere it is represented by the equation $$x[n] \ \triangleq \ \sum_{k=0}^{N-1} \ X[k] \ e^{j 2 \pi nk/N}$$

$$X[k] \ = \ \frac{1}{N} \sum_{n=0}^{N-1} \ x[n] \ e^{-j 2 \pi nk/N}$$

While in other literature $$x[n] \ \triangleq \frac{1}{N} \sum_{k=0}^{N-1} \ X[k] \ e^{j 2 \pi nk/N}$$

$$X[k] \ = \ \sum_{n=0}^{N-1} \ x[n] \ e^{-j 2 \pi nk/N}$$

When is the scaling factor needs to be reversed? Which equation is to be used for 2-d Fourier Transform (Image TransforM - where to include $\frac{1}{MN}$)?