This is what I ended up getting
$$x = (aa^T)^{-1}ab$$
but I'm not sure how to proceed or what if I did was correct. The correct solution is
$$x = \frac{b}{\|a\|_2^2} a$$
This is what I ended up getting
$$x = (aa^T)^{-1}ab$$
but I'm not sure how to proceed or what if I did was correct. The correct solution is
$$x = \frac{b}{\|a\|_2^2} a$$
Note that $aa^T$ is an $n\times n$ matrix, assuming $a\in \mathbf{R}^n$ and it has rank one (i.e. it is not invertible) so your expression is mathematically undefined. I assume what you want is the least norm solution of the equation.
We know $a^Tx = b$ represents some hyperplane shifted away from the origin, $a$ is a vector normal to that hyperplane, and the point closest to the origin on the hyperplane will be the one that is perpendicular.
Take any point on the plane, call it $y$ (by definition $a^Ty = b$) and then take it's projection onto the normal vector $a$ (recall the orthogonal projection of a vector $x$ onto $y$ vector is $\mathbf{proj}_y x = \frac{y^Tx}{||y||^2} y$).
So the least norm solution is just $$x_{ln} = \mathbf{proj}_a y = \frac{a^Ty}{||a||^2} a = \frac{b}{||a||^2} a $$