Latex how to write backslash in Latex with or without amssymb : backslash , setminus, smallsetminus

Write default Latex backslash symbol

To write backslash symbol in LateX, you must use \backslash or \setminus command:

$$a\backslash b$$
$$A\setminus B$$

which gives:

\[a\backslash b\] \[A\setminus B\]

Latex backslash using package amssymb

To write backslash symbol in LateX using package amssymb you must use \smallsetminus command:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$$A \smallsetminus B$$
\end{document}
\[A \smallsetminus B\]