Derivative of $(Ax - y)^T(Ax - y)$ where $x$ and $y$ are vector of $n$ dimension and $A$ is matrix $n\times n$
I solved the function and broke it down to following expression:
$$f = x^TA^TAx -2x^TA^Ty + y^Ty$$
When taking its derivative $df/dx$ I am applying product rule to first and reaching to.
$$x^TA^TA + A^TAx - 2 A^Ty$$
Now the problem is this answer in not in any of the given options. Can anyone please tell me what am I doing wrong?

The dimension of $x^TA^TA$ and $A^TAx$ don't match.
$$A^TAx + A^TAx-2A^Ty = 2A^TAx - 2A^Ty$$