# What is the correlation function in multivariable/vectoral case?

I know that the correlation function between random variables $X$ and $Y$ is defined as

$$\rho_{X,Y}=\mathrm{corr}(X,Y)={\mathrm{cov}(X,Y) \over \sigma_X \sigma_Y} ={E[(X-\mu_X)(Y-\mu_Y)] \over \sigma_X\sigma_Y}.$$

What does happen when $\mathbf{X}$ and $\mathbf{Y}$ are random vectors?

$$\mathbf{X} = \begin{bmatrix} X_1 \\ X_2 \\ \vdots \\ X_n \end{bmatrix}, \quad \quad \mathbf{Y} = \begin{bmatrix} Y_1 \\ Y_2 \\ \vdots \\ Y_n \end{bmatrix}$$

How is the correlation function defined in this case?

$$\mathrm{corr}(\mathbf{X},\mathbf{Y}) \, \triangleq \, ?$$

-
Then the correlation is a matrix where the $(i,j)$th entry is the correlation between $X_i$ and $Y_j$. – Stefan Hansen Mar 31 '13 at 8:40

You almost answered your own question. Just put vectors with $X$ and $Y$ and transpose one of them to get a matrix: a covariance matrix. So, $$\mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \,(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}]).(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])^{T}$$ is a matrix with entries: $\mathrm{cov}(\mathbf{X},\mathbf{Y})_{ij}=\langle(X_i-\mu_{X_i})(Y_j-\mu_{Y_j})\rangle$.
@hkBattousai the difference is "in the mean". If you substract the mean from the vector (or scalar, that doesn't matter) then you have covariance if you don't then correlation. It is just terminology. $\mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \,(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}]).{(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])‌​}^{T}$ and $\mathrm{cor}(\mathbf{X},\mathbf{Y}) \, \triangleq \,\vec{\mathbf{X}}.\vec{\mathbf{Y}}^{T}$ – Caran-d'Ache Apr 1 '13 at 7:00
Isn't covariance defined as $\, \mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \, E\big[(\vec{\mathbf{X}}-E[\vec{\mathbf{X}}])(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}‌​])^{T}\big] \,$? You wrote $\, \mathrm{cov}(\mathbf{X},\mathbf{Y}) \, \triangleq \, (\vec{\mathbf{X}}-E[\vec{\mathbf{X}}])(\vec{\mathbf{Y}}-E[\vec{\mathbf{Y}}])^{T} \,$ instead. Are you sure that your definition is correct? – hkBattousai Apr 1 '13 at 11:23
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8377102613449097, "perplexity": 280.5635306670124}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-30/segments/1469257826736.89/warc/CC-MAIN-20160723071026-00294-ip-10-185-27-174.ec2.internal.warc.gz"}