I have a question on SIFT I am reading a paper on SIFT by Lowe.

In it, gradient magnitudes and orientations are calculated using these formulae:


$$$$
I don't know why m(x,y) is calculated above. I heard that gradient magnitude is usually calculated like the following.

$$\sqrt{f_x ^2 + f_y^2}
$$
Horizontal and vertical gradients are computed by taking neighbor pixel differences:

$$g_{x}=L(x+1,y)-L(x-1,y)\\g_{y}=L(x,y+1)-L(x,y-1)$$

Gradient magnitude is computed the same way as in your formula:

$$m(x,y)=\sqrt{g_x^2+g_y^{2}}$$

Replacing $g_{x}$ and $g_{y}$ with above will give you the original formula.

Gradients are usually computed by forward or central difference formula, but I think in this case the above is still accurate enough since the image $L$ is smoothed.