# Trying to understand line integrals for potential energy equations

So above is a hypothetical problem I gave myself to figure out if I could do potential differences properly using Newton's Gravitation Formula and I wasn't 100% that my Math was correct (I'm basically self-taught on line integrals), so I wanted some feedback on that. The problem is that there is some mass $M$ evenly distributed in a circle with radius 1 m at some point in 2-space. What is the gravitational potential difference between the surface of this 2D "planet" and the point $(x_1, y_1)$? (Pretend there are subscripts in my diagram). For convenience purposes, I centered the "planet" at the origin.

$$V_g = \int_C \vec{F_g}(x,y) \cdot d\vec{s}$$ $$\vec{F_g}(x,y) = \frac{GM}{x_1^2 + y_1^2}\boldsymbol{\hat{\textbf{r}}}$$ $$V_g = \int_C \frac{GM}{x_1^2 + y_1^2}\boldsymbol{\hat{\textbf{r}}} \cdot d\vec{s}$$ $$= \int_{\cos(\tan^{-1}\frac{y_1}{x_1})}^{x_1}\frac{GM}{x^2 + \sin^2(\tan^{-1}\frac{y_1}{x_1})}dx + \int_{\sin(\tan^{-1}\frac{y_1}{x_1})}^{y_1}\frac{GM}{x_1^2 + y^2}dy$$ $$=GM\bigg(\int_{\cos(\tan^{-1}\frac{y_1}{x_1})}^{x_1}\frac{1}{x^2 + \sin^2(\tan^{-1}\frac{y_1}{x_1})}dx + \int_{\sin(\tan^{-1}\frac{y_1}{x_1})}^{y_1}\frac{1}{x_1^2 + y^2}dy\bigg)$$ $$=GM\bigg(\bigg[\frac{1}{\sin(\tan^{-1}\frac{y_1}{x_1})}\tan^{-1}\bigg(\frac{x}{\sin(\tan^{-1}\frac{y_1}{x_1})}\bigg)\bigg|_{\cos(\tan^{-1}\frac{y_1}{x_1})}^{x_1} \bigg] + \bigg[ \frac{1}{x_1}\tan^{-1}\bigg(\frac{y}{x_1}\bigg)\bigg|_{\sin(\tan^{-1}\frac{y_1}{x_1})}^{y_1}\bigg]\bigg)$$

Also, yes, I realize I unnecessarily punished myself using Cartesian coordinates, so here's the whole thing in polar coordinates.

$$V_g = \int_1^{r_1} \frac{GM}{r^2}dr = \int_1^{r_1} GMr^{-2}dr = \frac{-GM}{r}\bigg|_1^{r_1} = GM - \frac{GM}{r_1}$$

$V_g = \int_C \frac{GM}{x_1^2 + y_1^2} \|d\mathbf r\|\\ \mathbf r(t) = R(\cos t, \sin t)\\ d\mathbf r = R(-\sin t, \cos t)\ dt\\ \|d\mathbf r\| = R \ dt\\ V_g = \int_0^{2\pi} \frac{GMR}{x_1^2 + y_1^2} \ dt$
But I am not sure about our equation. You say, $x_1,y_1$ is a fixed point.
You need the distance from some $x_1,y_1$ in the interior to each $x,y$ on the rim.
$V_g = \int_C \frac{GM}{(x-x_1)^2 + (y-y_1)^2} \|d\mathbf r\|\\ \int_0^{2\pi} \frac{GM}{R^2 - 2x_1R\cos t - 2y_1 R\sin t + x_1^2 + y_1^2} R \ dt$