When I transform an image from the spatial domain to the frequency domain, some frequencies are negative. What is the meaning of the negative sign?
Each DCT output bin is a (weighted) correlation against a cosine function of a certain frequency. A negative value would represent a negative correlation, e.g. something in the image data is of the opposite phase to that cosine (e.g. maybe dark when the cosine is 1, and light when the cosine is -1, instead of vice-versa for a positive correlation).
b is the same size as
a and contains the discrete cosine transform coefficients indicating the correlation between the cosine function at two specific frequencies. They are not necessary to be positive values. The dimension,
4*4 in your case, represents the different frequencies.
Consider a 1-D delta function. It can be written as difference of two unit step trains. All we have done is represent one data in terms of another - mathematically, we are using a different set of basis vectors for representing same data. d(n) = u(n) - u(n-1) Similarly, in the DCT, one is trying to express some data in terms of a different basis vector set - the set of cosine functions. And just like in any general vector space, some of the coefficients might be negative. There is no other real great physical significance to this.