# What's Logic Behind the Construction of Sobel's Filter in Image Processing?

I am basically very new to this image processing field. I am presently working on edge detection on colour images. While learning the basics of edges and edge detection in images, I encountered image derivatives and spatial masks for the corresponding operations. It's where I happened to learn about Prewitt operator and Sobel operators. I cannot understand the logic behind the construction of these masks and how does it detect lines. Can someone help me please?

$$\begin{bmatrix} -1 &0 &1 \end{bmatrix}$$ to detect variations across lines, the other the shortest non-trivial Pascal/Gaussian smoothing $$\begin{bmatrix} 1&2&1 \end{bmatrix}^T$$ to smooth along columns, resulting in, for instance: $$\begin{bmatrix} 1&2&1 \end{bmatrix}^T\cdot \begin{bmatrix} -1 &0 &1 \end{bmatrix}$$ or $$\begin{bmatrix} -1 &0 &1 \\ -2 &0 &2 \\ -1 &0 &1 \\ \end{bmatrix}$$
Of course, the 3-point derivative often has an additional $$1/2$$ factor: $$\begin{bmatrix} -1/2 &0 &1/2 \end{bmatrix}$$ to get the appropriate scale factor, and the Pascal smoother has a $$1/4$$ factor to have its coefficients sum to one $$\begin{bmatrix} 1/4&1/2&1/4 \end{bmatrix}$$ but the resulting global scaling of $$1/2\times 1/4$$ does not change the edge detection power for such linear filters.