Many sites give the Sobel operators as the convolution mask for smoothing an image. However, I haven't found a single site that describes how you can derive the operators from partial first derivatives. If anyone can explain the derivation, I would highly appreciate it.
Deriving the Sobel equations from derivatives
image processing;computer vision
The Sobel operator is an approximation of the derivative in the X dimension followed by a simple smoothing operator in the Y dimension.  (Or derivative in the Y dimension and then smoothed in X).Consider a one-dimensional signal $f(t)$.  The derivative of $f(t)$, $d f(t) / dt$ can be written as:$$\lim_{\Delta \rightarrow 0} \frac{f(t+\Delta) - f(t-\Delta)}{2\Delta}$$This is called the centered difference formula.But with a discrete signal the smallest $\Delta$ you have at your disposal is the distance between samples, so you use that as an approximation of the limit.We can see just how bad (or good) an approximation it is by looking at what it does to a complex exponential signal $e^{\omega i t}$.  The true derivative would give $\omega i e^{\omega i t}$.  The approximation gives$$\frac{e^{\omega i (t+1)} - e^{\omega i (t-1)}}{2} =\frac{e^{\omega i}e^{\omega i t}-e^{-\omega i}e^{\omega i t}}{2} =\frac{e^{\omega i} - e^{-\omega i}}{2}e^{\omega i t} =i \sin(\omega)e^{\omega i t}$$so extremely accurate with low frequencies ($\omega$ near 0), but increasingly inaccurate as $\omega$ approaches the Nyquist frequency ($\omega \rightarrow \pi$).  This is about the best you are going to do with three samples.  It also has the advantage of over-attenuating the high frequency response rather than over-amplifying.Now let's do some smoothing in the Y dimension.  We want something that only uses 3 points, and about the best you are going to get is $\frac{1}{4}f(t-\Delta) + \frac{1}{2}f(t) + \frac{1}{4}f(t+\Delta)$.  This filter has frequency response:$$\frac{1}{4}e^{\omega i (t - \Delta)} + \frac{1}{2}e^{\omega i t} + \frac{1}{4}e^{\omega i (t + \Delta)} =\frac{1}{2}(1 + \frac{e^{-\omega i \Delta}+e^{\omega i \Delta}}{2})e^{\omega i t} =\frac{1}{2}(1 + \cos \omega)e^{\omega i t}$$which smoothly transitions from passing low frequencies to completely attenuating high frequencies.So convolve the derivative approximation in the X dimension with the smoother in the Y dimension and you get the kernel:$$\frac{1}{8}\left[\begin{array}{ccc}1 & 0 & -1 \\2 & 0 & -2 \\1 & 0 & -1\end{array}\right].$$