Covariance in LaTeX (\text{Cov}(X,Y))
- LaTeX command
\text{Cov}(X,Y)- Package
- Add to your preamble:
\usepackage{amsmath} - Mode
- Text and math mode
Where it is used
Covariance of X and Y, measuring how the two random variables vary together.
Defined by \text{Cov}(X,Y) = \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y], it underlies the correlation \rho = \text{Cov}(X,Y)/(\sigma_X\sigma_Y) and covariance matrices, usually written \Sigma. Independent variables have zero covariance, though the converse fails in general. As with Var, \operatorname{Cov} or a declared operator gives sturdier output than \text{Cov}, which picks up italics in theorem statements. Add a thin space after the comma, (X,\,Y), if the arguments look cramped. For a random vector, \operatorname{Cov}(\mathbf{X}) denotes the full covariance matrix. A positive value means the variables tend to move in the same direction.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}
Covariance: $\text{Cov}(X,Y)$
\[ \text{Cov}(X,Y) = \mathbb{E}[XY] - \mathbb{E}[X]\,\mathbb{E}[Y] \]
\end{document}Related symbols
All Kansrekening & Statistiek →Frequently asked questions
- How do I write Covariance in LaTeX?
- Type \text{Cov}(X,Y) in math mode, for example $\text{Cov}(X,Y) = \mathbb{E}[XY] - \mathbb{E}[X]\,\mathbb{E}[Y]$. Load amsmath first with \usepackage{amsmath}.
- Which package do I need for \text{Cov}(X,Y)?
- \text{Cov}(X,Y) needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
- Can I use \text{Cov}(X,Y) in text mode, or only in math mode?
- Both. \text{Cov}(X,Y) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Beste AI LaTeX Editor, Overleaf Alternatief
Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI
- Genereer mooie TikZ-diagrammen met AI
- Upload afbeelding en converteer naadloos naar LaTeX
- Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen