How to quantify delay in filtered output? I have a signal containing two sine tones 30 kHz and 60 KHz. I used a second order IIR notch filter to filter out the 60 KHz component from the signal, so now the signal has only 30 KHz component.

When comparing the filtered out signal with a pure 30 KHz tone generated, the earlier samples are very much different but later samples are matching to some good extent.

Plot with earlier samples:


Plot with later samples:


What are the reasons why there is a delay before response being proper?
How can i mathematically quantify this?

Like after how many samples the filtered output will be reasonably matching with that of pure tone?
It's the transient and the group delay which are associated with the initial conditions and the LTI filter phase response $\phi(w)$ respectively.

The group delay (in samples) associated with the LTI filter is:
$$\tau = - \frac{d \phi(w) }{dw} $$

The output will be shifted by $\tau$ samples wrt to the input. You shall compansate this shift for synchronization.

This delay is constant for linear phase filters which are of symmetric FIR type filters. For IIR type filters, since their phase response is not linear therefore getting a fixed group delay is not possible.