Discrepancies in defining the curvature of a Cartesian function I was thinking about how one might be able to define how curved a function was. I thought of two ways:

Method 1
The angle of a tangent of a function is $\arctan\left(\frac{dy}{dx}\right)$ (which we'll define as $\theta$). The rate that the angle of the tangent changes (or $\frac{d\theta}{dx}$) is, thus, $$\frac d{dx}[\theta]=\frac d{dx}\left[\arctan\left(\frac{dy}{dx}\right)\right]=\frac{d^2y}{dx^2}\arctan'\left(\frac{dy}{dx}\right)=\frac{\frac{d^2y}{dx^2}}{1+\left(\frac{dy}{dx}\right)^2}=\frac{f''(x)}{1+(f'(x))^2}$$
Hence the curvature of a function is $\frac{f''(x)}{1+(f'(x))^2}$.

Method 2
We can define the curvature of a circle $(x-a)^2+(y-b)^2=r^2$ as having curvature $\frac1r$. For each point on a function, we find $a,b,r$ that approximates the function well around that point, i.e. such that $(x-a)^2+(y-b)^2=r^2$ intersects at the point, and has the same first and second derivative as the function at that point, and calculate $\frac1r$ from there.
The first derivative of a circle is $\frac d{dx}\left[(x-a)^2+(y-b)^2\right]=\frac d{dx}r^2\Rightarrow \frac d{dx}\left[(x-a)^2\right]+\frac d{dx}\left[(y-b)^2\right]=0\Rightarrow 2\frac d{dx}\left[x-a\right](x-a)+2\frac d{dx}\left[(y-b)\right](y-b)=0\Rightarrow x-a+\frac {dy}{dx}(y-b)=\frac {dy}{dx}(y-b)=-(x-a)\Rightarrow\frac {dy}{dx}=-\frac{x-a}{y-b}$
The second derivative of a circle is $\frac d{dx}\left[\frac {dy}{dx}\right]=\frac d{dx}\left[\frac{a-x}{y-b}\right]\Rightarrow \frac{d^2y}{dx^2}=\frac{\frac d{dx}[a-x](y-b)-\frac d{dx}[y-b](a-x)}{(y-b)^2}=\frac{-(y-b)-\frac d{dx}[y-b](a-x)}{(y-b)^2}=-\frac{y-b+\frac{dy}{dx}(a-x)}{(y-b)^2}=-\frac{y-b+\frac{a-x}{y-b}(a-x)}{(y-b)^2}=-\frac{(y-b)^2+(a-x)^2}{(y-b)^3}=-\frac{r^2}{(y-b)^3}$
Thus, we have the following system of equations:
$$
\begin{cases}
(x-a)^2+(y-b)^2=r^2 \\
-\frac{x-a}{y-b}=y' \\
-\frac{r^2}{(y-b)^3}=y'' \\
\end{cases}
$$
To solve this equation, we first write $(y-b)^2=r^2-(x-a)^2$ and square both sides of the bottom two equations to get:
$$
\begin{cases}
(y-b)^2=r^2-(x-a)^2 \\
\frac{(x-a)^2}{(y-b)^2}=\left(y'\right)^2 \\
\frac{r^4}{(y-b)^6}=\left(y''\right)^2 \\
\end{cases}
$$
Now replace $(y-b)^2=r^2-(x-a)^2$ and multiply the bottom two equations by $(y-b)^2$ and $(y-b)^6$ respectively:
$$
\begin{cases}
(x-a)^2=\left(y'\right)^2\left(r^2-(x-a)^2\right) \\
r^4=\left(y''\right)^2\left(r^2-(x-a)^2\right)^3 \\
\end{cases}
$$
We can unpack the second equation:
$$(x-a)^2=\left(y'\right)^2\left(r^2-(x-a)^2\right)=\left(y'\right)^2r^2-\left(y'\right)^2(x-a)^2$$
$$\left(1+\left(y'\right)^2\right)(x-a)^2=\left(y'\right)^2r^2$$
$$(x-a)^2=\frac{\left(y'\right)^2}{1+\left(y'\right)^2}r^2$$
This leaves us with the equation $r^4=\left(y''\right)^2\left(r^2-(x-a)^2\right)^3$. Substituting $(x-a)^2=\frac{\left(y'\right)^2}{1+\left(y'\right)^2}r^2$ gives us
$$r^4=\left(y''\right)^2\left(r^2-\frac{\left(y'\right)^2}{1+\left(y'\right)^2}r^2\right)^3$$
$$r^4=\left(y''\right)^2\left(\frac1{1+\left(y'\right)^2}r^2\right)^3$$
$$r^4=\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}r^6$$
$$\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}r^6-r^4=0$$
$$r^4\left(\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}r^2-1\right)=0$$
(It seems that the quadruple root at $r=0$ is extraneous, so we can divide by $r^4$)
$$\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}r^2-1=0$$
$$\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}r^2=1$$
$$r^2=\left(\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}\right)^{-1}$$
$$\frac1r=\sqrt{\frac{\left(y''\right)^2}{\left(1+\left(y'\right)^2\right)^3}}=\frac{y''}{\left(1+\left(y'\right)^2\right)^\frac32}$$
Hence the curvature of a function is $\frac{f''(x)}{\left(1+\left(f'(x)\right)^2\right)^\frac32}$.

The two methods that I used to define curvature ended up giving different formulae for curvature, a result I was not expecting. According to the Wikipedia article for curvature the formula from Method 2 is the generally accepted formula for finding the curvature of . The definition seems to originally come from so-called "osculating circles", which seems remarkably similar to what I did in method 2. What I have yet to find, however, is why my first method gave a different result from my second result?
(Something I found note-worthy is that the integral of $\frac{f''(x)}{\left(1+\left(f'(x)\right)^2\right)^\frac32}$ is $\frac{f'(x)}{\sqrt{1+\left(f'(x)\right)^2}}$. Note that the denominator, $\sqrt{1+\left(f'(x)\right)^2}$, is the derivative of the arc length of $f(x)$. The second formula seems somehow related to arc length and the first one isn't. Not quite sure what to make of it.)

Looking back at the question, I began to wonder why I defined the curvature of a circle as $\frac1r$ in the first place. I never really thought deep about it when thinking about curvature, and I wondered if the answer would lie there.
Intuitively the amount of "time" it would take for a circle to curve  is inversely proportional to its radius. Consider the equation $f(x)=\sqrt{r^2-x^2}$ (a semicircle). At $x=-r$ the tangent of the function is pointing $\frac\pi2$ degrees up, while at $x=-r$ the tangent is pointing $\frac\pi2$ degrees down. It took a change in $x$ of $2r$ to change the angle of the tangent (which we shall denote by $\theta$) by the same amount, $\pi$. However the (average) change in $\theta$ with respect to change in $x$ would then be $\frac\pi{2r}$, not $\frac1r$ as Method $2$ implies. Maybe I wasn't evaluating the change of $\theta$ with respect to $x$, but some other variable, to define curvature in Method $2$?
That's when it hit me. If I were to trace a path of length $l$ along a circle of radius $r$, by definition the angle change would be $\frac lr$. I was measuring the change in angle with respect to the change in arc length in method $2$, i.e. I was evaluating $\frac{d\theta}{dl}$ (where $l$ is arc length, and $dl=\sqrt{1+\left(\frac{dy}{dx}\right)^2}dx$).  However, in method 1 I was evaluating $\frac{d\theta}{dx}$. Of course the two results would be different!
When looking at the results from this perspective, the two results actually agree with each other. We have:
$$\frac{d\theta}{dl}=\frac{d\theta}{dx}\cdot\frac{dx}{dl}=\frac{d\theta}{dx}\cdot\frac{dx}{\sqrt{1+\left(\frac{dy}{dx}\right)^2}dx}=\frac{d\theta}{dx}\cdot\frac1{\sqrt{1+\left(f'(x)\right)^2}}$$
From method $1$ I found that $\frac{d\theta}{dx}=\frac1{1+\left(f'(x)\right)^2}$. Inserting this in, we have
$$\frac{d\theta}{dl}=\frac{d\theta}{dx}=\frac1{1+\left(f'(x)\right)^2}\cdot\frac1{\sqrt{1+\left(f'(x)\right)^2}}=\frac1{\left(1+\left(f'(x)\right)^2\right)^\frac32}$$
Which is the result I got in method $2$.
Looking back, I can understand why curvature isn't defined as $\frac{d\theta}{dx}$. $\theta$ is a co-ordinate found when using the polar co-ordinate system, while $x$ is a co-ordinate found when using the Cartesian co-ordinate system. It makes no sense to mix and match co-ordinates from different co-ordinate systems. On the other hand, arc length is a thing, both in the Cartesian and polar co-ordinate systems, and it does make more sense to talk about angles with respect to arc lengths.
As I was skimming though the Wikipedia page on curvature, I also noticed that vectors were used a lot. It is less nonsensical to talk about arc length (which in the case of vectors is just the norm), rather than talking about the length of a vector in some arbitrary direction.
In the end, this investigation into curvature has shown me that I should broaden my perspective when looking at mathematics, because sometimes the most obvious perspective may not end up being the most useful one. In this case, thinking about the change in the angle of the function in terms of $x$ was the most obvious perspective, but in reality it would have made more sense to think about the change in the angle of the function in terms of $l$.
