# Fitting a sinusoid vs. DTFT

I want to fit a sinusoid to a given discrete finite real signal $$X(n)$$ with length $$N$$. Of particular interest is the frequency. For the estimation for example least squares can be utilized:

$$\text{min}_{r,\phi,k}(\sum_{n=0}^{N-1}(X(n)-r\text{cos}(\frac{kn\cdot2\pi}{T}-\phi))^2)$$ $$=\text{min}_{a,b,k}(\sum_{n=0}^{N-1}(X(n)-a\text{cos}(\frac{kn\cdot2\pi}{T})-b\text{sin}((\frac{kn\cdot2\pi}{T}))^2)$$

The optimization problem looks a lot like solving for the argmax of a Fourier transform, or more precisely $$DTFT$$. Quite naturally one may start to think whether maximizing the absolute value of the $$DTFT$$ gives the same result.

$$DTFT_{\frac{1}{T}}(k)=\sum_{n=0}^{N-1}X(t)e^{\frac{-1j\cdot 2\pi\cdot kn}{T}}$$

So that we get a maximization problem with only the frequency as an argument:

$$\text{max}_k(abs(DTFT_\frac{1}{T}(k)))$$

Basically it boils down to checking the correctness of the following two steps.

1) DTFT solves the coefficients $$a,b$$ correctly. IE. as output we get $$(a,-ib)$$.

2) At the minimum $$r=abs(a,-ib)$$ is maximized.

The result seems that at least 1) does not hold, which is quite interesting since ome might think that $$DTFT$$ solves those coefficients. It only holds for integer valued $$k$$. Why is this?

It's doubtful that 2) holds either. Any thoughts?

Overall, does this seem like a sound method of estimation? (At least for a particular problem I had it worked).