How do I sum the discrete cosine transform cosine waves? Sorry if this sounds like a stupid question, I'm new to DCT.

I've implemented various types of DCT (like IV and II) and they all give vastly different coefficients. From what I've read, the DCT expresses a signal as a sum of cosine waves with various oscillating frequencies. How can different formulas that give different coefficients express the same signal? I created 7 cosine waves (With one DC coefficient) on a graph with proportional periods according to N, and summed them but end up with a function that doesn't represent the signal at all. I'm probably doing this wrong, but here's what I did:

Calculated the 1D-DCT-II of this array:
 [1 2 3 4 5 6 7 8]
DCT:

[12.727922061358 -6.4423230227051 -1.3322676295502E-15 -0.67345480090394 0 -0.200902903736 -1.5765166949677E-14 -0.050702322759621]


Now I don't know if this is how to do it but I tried this (with a window of length 8):

12.72 + -6.44cos((pi/7)x)+ 0cos((pi/3.5)x)...


I can use the inverse DCT (DCT-III) and get the input values back, but I want to see the signal that represents the original input values. I tried summing the frequencies but I don't know if I'm doing it right so can someone guide me? 
Btw the formula I used was

$y[$n]= $realarray[$n]*cos((M_PI/$N)*($n+0.5)*($k));
You used the DCT-II with a certain scaling convention:

$$X[k]=s[k]\sum_{n=0}^{N-1}x[n]\cos\left(\frac{\pi}{2N} (2n+1)k\right),\qquad k=0,1,\ldots,N-1\tag{1}$$

where $s[0]=1/\sqrt{N}$, and $s[k]=\sqrt{\frac{2}{N}}$ for $k=1,\ldots,N-1$. Its inverse is given by an appropriately scaled DTC-III:

$$x[n]=\sum_{k=0}^{N-1}s[k]X[k]\cos\left(\frac{\pi}{2N} (2n+1)k\right),\qquad n=0,1,\ldots,N-1\tag{2}$$

where $s[k]$ are the same scaling coefficients as used in $(1)$.

So, given the scaled DCT-II coefficients $X[k]$, the original signal can be written as

$$x[n]=\sqrt{\frac{2}{N}}\left[\frac{1}{\sqrt{2}}X[0]+X[1]\cos\left(\frac{\pi(2n+1)}{2N}\right)+X[2]\cos\left(\frac{\pi(2n+1)}{N}\right)+\ldots\right]$$