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 Probability at Statistics →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.
Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf
Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI
- Gumawa ng magagandang TikZ diagrams gamit ang AI
- Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
- Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers