I recently started learning about wavelet transforms, and there's something that is confusing me. My understanding was that most wavelet decompositions are simply a decomposition of a given signal in an orthonormal basis. This seems to be true for something like Haar wavelets. If I generate a signal of length $N = 2^k$, I get the same number of coefficients as the input signal:
import numpy as np import pywt signal = np.random.rand(128) haar_coefs = pywt.wavedec(signal, wavelet="haar", level = np.log2(len(signal)).astype(int) ) # Haar decomposition coefficients # Total number coefficients in Haar wavelet decomposition sum([len(level) for level in haar_coefs]) # returns 128 so this seems correct for the Haar basis. However, as soon as I move to a different mother wavelet, e.g. Daubechies-2, the number of coefficients gets larger than the input signal:
db2_coefs = pywt.wavedec(signal, wavelet="db2", level = np.log2(len(signal)).astype(int) ) # db2 decomposition coefficients # Total number coefficients in db2 wavelet decomposition sum([len(level) for level in db2_coefs]) # returns 143 There are 15 too many coefficients here! How can this be an orthonormal basis? First I thought maybe the db2 transform isn't orthonormal, but the Wikipedia page says otherwise.
Edit: This question seems to ask something similar. I don't think the accepted answer answers my question though. My question isn't really about what exactly the number of coefficients is. My question is that if the coefficients of the wavelet decomposition aren't equal to the length of the signal $N$, then those wavelets can't be an orthonormal basis of the signal space (i.e. $\mathbb{R}^N$). So why are these called an orthonormal basis in e.g., the Wikipedia page? What am I missing?