Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm implementing DCT, but I don't see the difference with the Inverse DCT formula. Both formula are on the Wikipedia page. The difference looks to be the normalization factor, but I don't see how to implement it.



share|cite|improve this question
That doesn't sound surprising, although I would expect an additional sign flip somewhere too. What do you mean by "I don't see how to implement it"? – Hurkyl Oct 26 '12 at 4:52
I'm writing an script that does the actual calculation. I got the DCT working, but don't understand what's different in the Inverse DCT. Specially alpha... – whynot Oct 26 '12 at 5:11
up vote 0 down vote accepted

The fourier transform is a $\pi\over 2$ rotation in the time-frequency plane (see LCT) and the inverse fourier transform $\mathcal F^{-1}\{f(x)\}$ is equivalent to $\mathcal F\{f(-x)\}$ so that kind of symmetry is to be expected. For a really simple implementation, you can just copy-paste those formulas into code.

By the way, why are you making your own implementation?

share|cite|improve this answer
but what is alpha(u) and alpha (v) in the Inverse DTC formula? That's what I don't get. I'm doing a super simple implementation, just to see how it works. :) – whynot Oct 26 '12 at 5:55
I believe they are just normalizing factors to ensure that you don't end up with a scaled version of the input after taking the DCT and IDCT. $u$ and $v$ are the indices of the matrix/array. – Navin Oct 26 '12 at 6:04
Yes.. that's what I need to figure out... the values for the DCT are are clearly defined but not for the inverse. Thanks! – whynot Oct 26 '12 at 6:08
@whynot If that answered your question, don't forget to accept the answer :) – Navin Oct 26 '12 at 23:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.