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?

  • 1
    $\begingroup$ I’m not a wavelet expert, but I’m guessing it has to do with how boundary conditions are handled. A possible analogy using the FFT would be zero padding. If you have an $M$ length signal, you can zero-pad it to length $N$ and decompose the zero-padded signal into an $N$-dimensional basis. $\endgroup$
    – Baddioes
    Commented Mar 28 at 4:19

1 Answer 1


Orthogonality of discrete wavelets has something to do with certain "waveforms" being orthogonal to its translates all over the integer line $]-\infty,\ldots,-2,-1,0,1,2,\ldots\infty[$. Plus a two-scale equation. The resulting infinite "matrix" $W$ transforming an infinite vector $x$ into an infinite vector $w$ of wavelet coefficients would be orthogonal. There, $x$ and $w$ are of the "same" infinite size. When the support of $x$ is finite, the actual finite matrix would be orthogonal in its center, but not on the sides; because this restriction does not allow the infinite "orthogonal to translates" principles anymore. Except notably with Haar wavelets, which do overlap so nicely that borders don't matter.

Therefore, there are three main options:

  • allow a coefficient expansion, hence redundancy (but you can pad the original signal with zeroes)
  • make the signal "somehow" infinite through periodization and border management
  • modify the finite wavelet matrix on the sides. It looses its "pure wavelet" aspect, and becomes something else, sometimes called "wavelet on the interval", "adapted lifting", etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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