I am trying to find gravitational potential energy by integrating the gravitational force:
$$\mathbf{F}(\mathbf{r}) = - \ G \frac{Mm}{|\mathbf{r}|^2} \ \hat{\mathbf{r}}$$
where $\mathbf{r}$ is the vector from the centre of the Earth with mass $M$ towards the point of a mass $m$, and $\hat{\mathbf{r}}$ is the unit vector pointing towards the vector $\mathbf{r}$.
The potential energy at a point of the distance $|\mathbf{r}|$ can be found from
$$U(\mathbf{r}) = -\int_{\infty}^{r} - \ G \frac{Mm}{|\mathbf{r}|^2} \hat{\mathbf{r}} \ \cdot \ d\mathbf{r}$$
Then, removing the minus signs the expression becomes
$$U(\mathbf{r}) = \int_{\infty}^{r} \ G \frac{Mm}{|\mathbf{r}|^2} \hat{\mathbf{r}} \ \cdot \ d\mathbf{r}$$
However, look at the picture below that I drew.
Since I am integrating from infinity to a point r, I thought $d\mathbf{r}$ should be directed towards the opposite direction of $\hat{\mathbf{r}}$, but actually, if I calculate in that way I get
$$U(\mathbf{r}) = \frac{GMm}{r},$$ in which the minus sign is omitting.
From a mathematical perspective, either of $\hat{\mathbf{r}}$ and $\mathbf{r}$ direct towards the same direction, hence the scalar product should be a positive value.
But I still do not understand why $\hat{\mathbf{r}}$ and $d\mathbf{r}$ should be considered the same direction whenever I am calculating. This is perhaps not accounting for the upper and lower bounds.
Can anybody explain please?