Tx · LaTeX & TikZ

How to Write the Not-Independent Symbol in LaTeX

Updated 13 October 2026

At a glance

  1. 1. Load the package

    Add centernot to the preamble so the negation slash can be centered over a symbol.

  2. 2. Build the relation

    Use two perpendicular symbols for independence, then negate the full symbol with centernot.

  3. 3. Set relation spacing

    Wrap the result in mathrel so it has the spacing of a mathematical relation.

To typeset “XX is not independent of YY” in LaTeX, place a negation slash over the full double-perpendicular independence symbol. The centernot package provides a convenient way to center that slash.

A common notation for independence is X⊥ ⁣ ⁣ ⁣⊥YX \perp\!\!\!\perp Y. Negate the whole relation with \centernot:

X \centernot{\perp\!\!\!\perp} Y

The \centernot command supplies the spacing of a relation, like == or ≤\leq.

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 XX and YY are not independent.

Conditional independence

For variables that are not independent given ZZ, add a conditioning bar and ZZ:

X \centernot{\perp\!\!\!\perp} Y \mid Z

This is read as “XX is not independent of YY given ZZ.” The corresponding independence statement is commonly written X⊥ ⁣ ⁣ ⁣⊥Y∣ZX \perp\!\!\!\perp Y \mid Z.

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: \centernot is not defined by basic LaTeX. Include \usepackage{centernot} in the preamble.
  • Negating only one perpendicular: \not\perp places a slash over a single perpendicular mark, not necessarily over the double symbol.
  • Adding an unnecessary wrapper: \centernot supplies relation spacing itself, so an outer \mathrel{...} is redundant.
  • Confusing perpendicularity with independence: A lone ⊥\perp can mean geometric perpendicularity. The double-perpendicular form is a common convention for probabilistic independence.

References

  1. The centernot package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.