How to Write the Not-Independent Symbol in LaTeX
At a glance
- 1. Load the package
Add centernot to the preamble so the negation slash can be centered over a symbol.
- 2. Build the relation
Use two perpendicular symbols for independence, then negate the full symbol with centernot.
- 3. Set relation spacing
Wrap the result in mathrel so it has the spacing of a mathematical relation.
To typeset “ is not independent of ” in LaTeX, place a negation slash over the full double-perpendicular independence symbol. The centernot package provides a convenient way to center that slash.
Recommended notation
A common notation for independence is . Negate the whole relation with \centernot:
X \centernot{\perp\!\!\!\perp} Y
The \centernot command supplies the spacing of a relation, like or .
Complete example
This minimal document uses the centernot package. No additional package is needed for the displayed equation.
\documentclass{article}
\usepackage{centernot}
\begin{document}
\[
X \centernot{\perp\!\!\!\perp} Y
\]
\end{document}
Compile the document with a standard LaTeX engine such as pdfLaTeX. The result shows a slash centered over both perpendicular marks, expressing that and are not independent.
Conditional independence
For variables that are not independent given , add a conditioning bar and :
X \centernot{\perp\!\!\!\perp} Y \mid Z
This is read as “ is not independent of given .” The corresponding independence statement is commonly written .
Why not use \not directly?
A quick alternative is \not\!\perp\!\!\!\perp. It may work in some settings, but \not is designed to negate a following symbol. With a hand-built double-perpendicular symbol, the slash can appear over only the first mark or be positioned awkwardly. \centernot{...} explicitly centers the slash over the entire expression.
The double-perpendicular symbol itself is usually assembled from two \perp commands with negative spaces. The exact number of \! spacing commands is a typographic convention, so a document or journal may use a slightly different construction. The important point is to apply the negation to the complete independence symbol.
Common mistakes
- Forgetting the package:
\centernotis not defined by basic LaTeX. Include\usepackage{centernot}in the preamble. - Negating only one perpendicular:
\not\perpplaces a slash over a single perpendicular mark, not necessarily over the double symbol. - Adding an unnecessary wrapper:
\centernotsupplies relation spacing itself, so an outer\mathrel{...}is redundant. - Confusing perpendicularity with independence: A lone can mean geometric perpendicularity. The double-perpendicular form is a common convention for probabilistic independence.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.