Explanation of line element formula $dl^2 = dx^2 + dy^2$ I found this in a physics textbook without justification: $$dl^2 = dx^2 +dy^2,$$
where I presume that $l = \sqrt{x^2+y^2}$.
Why is this so?
By my calculations I obtain $$ dl = \dfrac{\partial l}{\partial x} \, dx + \dfrac{\partial l}{\partial y} \, dy= \dfrac{x \, dx + y \, dy}{\sqrt{x^2+y^2}},$$
and squaring
$$ dl^2 = \dfrac{x^2 \, dx^2 + y^2 \, dy^2 +2xy \, dx \, dy}{x^2+y^2}. $$
Are they the same? Am I doing something wrong?
 A: Your presume wrong: if $dl^2=dx^2+dy^2$, you can't conclude $l=\sqrt{x^2+y^2}$. You're talking about differentials here.
All that you can say starting from
$$dl^2=dx^2+dy^2$$
is that 
$$dl=\sqrt{dx^2+dy^2}$$
This is the result of considering the differential length of arc $dl$ as the hipotenuse of a triangle made of sides $dx$, $dy$, and $dl$ in the cartesian plane.
A: You have interpreted $dl$ as the differential of some function $l(x,y)$ defined over 
some domain in $\mathbb{R}^2$. The truth is it isn't. It is true that we can view $dl$ as a differential. However, it is one "living" on a one-dimension curve instead over some two-dimension domain.
Let $C \subset \mathbb{R}^2$ be any geometric figure in the plane that resemble our 
geometric notion of what a segment of a curve should be. If $C$ is regular enough
and we can parametrize it by two differentiable functions $x(t), y(t)$:
$$[0,T] \ni t \quad\mapsto\quad \gamma(t) = (x(t),y(t)) \in C \subset \mathbb{R}^2$$
We can define the length of $C$ as an integral.
$$L \stackrel{def}{=} \text{length}(C) = \int_0^T \sqrt{\left(\frac{dx(t)}{dt}\right)^2 + \left(\frac{dy(t)}{dt}\right)^2} dt$$
As a geometric figure, $C$ admits many different parametrization. The key point
is above definition of length is essentially independent of choice of parametrization.
Among all these parametrization, there is one more or less natural. It is called
arc-length parametrization.
For any point $p \in C$, let $t_p = \gamma^{-1}(p)$. The length of that portion of $C$
between $\gamma(0)$ and $p = \gamma(t_p)$ is once again given by an integral:
$$s(t_p) \stackrel{def}{=} \text{length}( \{\;\gamma(t) : 0 \le t \le t_p\; \} ) = \int_0^{t_p} 
\sqrt{\left(\frac{dx(t)}{dt}\right)^2 + \left(\frac{dy(t)}{dt}\right)^2} dt$$
We can view this length as a function of $p$ and the correspondence map
$$[ 0, L ] \in s \quad\mapsto\quad p \in C \;\text{ such that }\; s(t_p) = s$$
gives us the arc-length parametrization.
By defintion, we have
$$\frac{ds}{dt} = \frac{d}{dt} \int_0^t \sqrt{\left(\frac{dx(t)}{dt}\right)^2 + \left(\frac{dy(t)}{dt}\right)^2} dt
= \sqrt{\left(\frac{dx(t)}{dt}\right)^2 + \left(\frac{dy(t)}{dt}\right)^2}$$
Since this relation is essentially independent of choice of parametrization $t$,
we usually drop the $t$ and $dt$ in the formula and write it as
$$ds = \sqrt{dx^2 + dy^2}\quad\text{ or }\quad ds^2 = dx^2 + dy^2$$
Some authors also perfer to use $l$ instead of $s$ to denote the parameter in arc-length parametrization. As you can see, the $dl$ ( or $ds$ ) here is really the differential
for the function $l(t)$ ( or $s(t)$ ) living on the "curve" $C$ for some arbitrary parametrization $t$.
A: Just picture a tiny right triangle with width $dx$ and height $dy$ and hypotenuse $dl$.  By the Pythagorean theorem, $dl^2 = dx^2 + dy^2$.
