Main derivation
S01 · definition
Before
X,\ Y\ \text{on one law}\ (S,p)After
\operatorname{Cov}(X,Y)=E[XY]-E[X]E[Y],\quad E[g]=\sum_{s\in S}p(s)\,g(s)Conditions: \text{all expectations use the same }(S,p)
Rule: mko_cov_def · Uses: G1, mko_expectation_def
Leaf basis: mko_cov_def + mko_expectation_def + def_unfold
Define covariance by the MKO: compute E[X], E[Y] and E[XY], then subtract. All three expectations use the one joint law of G1, with sample space S and weights p (p is nonnegative and sums exactly to 1, the normalized weights the definition of expectation requires).
S02 · equivalent
Before
\operatorname{Cov}(Y,X)=E[YX]-E[Y]E[X]After
\operatorname{Cov}(Y,X)=E[XY]-E[X]E[Y]=\operatorname{Cov}(X,Y)Conditions: none
Rule: mul_comm · Uses: S01
Leaf basis: mul_comm + eq_replace + def_unfold
At every s∈S, Y(s)X(s)=X(s)Y(s) (real multiplication commutes), so YX and XY are the same function with the same expectation; E[Y]E[X]=E[X]E[Y] is also commutativity. So swapping the two variables does not change the covariance.
S03 · theorem_application
Before
E\Big[\sum_{k=1}^{m}c_kU_k\Big]After
\sum_{k=1}^{m}c_k\,E[U_k],\quad E[c]=cConditions: U_k\ \text{functions of}\ (X,Y)\ \text{on the same}\ (S,p)
Rule: L_lin_exp · Uses: S01, G1
Leaf basis: L_lin_exp
Computing covariance needs linearity of expectation. Lemma L_lin_exp is proved in S03.1 and S03.2; it needs only that every U_k lives on the same (S,p), and no independence.
S04 · theorem_application
Before
E[aX+b],\ E[cY+d]
After
E[aX+b]=a\,E[X]+b,\quad E[cY+d]=c\,E[Y]+d
Conditions: none
Rule: L_lin_exp · Uses: S03, G2
Leaf basis: L_lin_exp
Take m=2, U_1=X, U_2=1 (the constant function), c_1=a and c_2=b: E[aX+b]=aE[X]+bE[1]=aE[X]+b. The same with c and d for Y.
S05 · equivalent
Before
(aX+b)(cY+d)
After
ac\,XY+ad\,X+bc\,Y+bd
Conditions: none
Rule: distributive · Uses: G2, distributive
Leaf basis: distributive + mul_comm + mul_assoc
Expand the product pointwise at every s∈S: (aX(s)+b)(cY(s)+d)=acX(s)Y(s)+adX(s)+bcY(s)+bd. This is distributivity and commutativity of real numbers, valid for every s, so the two functions are equal (N1 checks this degree-four multilinear identity on a grid).
S06 · theorem_application
Before
E[(aX+b)(cY+d)]
After
ac\,E[XY]+ad\,E[X]+bc\,E[Y]+bd
Conditions: none
Rule: L_lin_exp · Uses: S03, S05
Leaf basis: L_lin_exp + eq_replace
Substitute the expansion of S05 into the expectation and apply the lemma (m=4, with U equal to XY, X, Y, 1 and coefficients ac, ad, bc, bd). Here E[XY] must be computed on the same joint law and must not be assumed to equal E[X]E[Y] merely from the marginals.
S07 · equivalent
Before
E[aX+b]\,E[cY+d]=(a\,E[X]+b)(c\,E[Y]+d)
After
ac\,E[X]E[Y]+ad\,E[X]+bc\,E[Y]+bd
Conditions: none
Rule: distributive · Uses: S04
Leaf basis: distributive + mul_comm + mul_assoc
Expand the product of the two reals aE[X]+b and cE[Y]+d by distributivity, with the same pattern as S05.
S08 · equivalent
Before
\operatorname{Cov}(aX+b,cY+d)=E[(aX+b)(cY+d)]-E[aX+b]\,E[cY+d]After
\operatorname{Cov}(aX+b,cY+d)=ac\,(E[XY]-E[X]E[Y])=ac\operatorname{Cov}(X,Y)Conditions: none
Rule: eq_replace · Uses: S01, S06, S07
Leaf basis: eq_replace + add_inverse + distributive + add_comm
Substitute S06 and S07 into the definition and subtract: the terms adE[X], bcE[Y] and bd cancel, leaving acE[XY]−acE[X]E[Y]=ac(E[XY]−E[X]E[Y])=ac·Cov(X,Y). The constants b and d disappear and the coefficients a and c multiply, signs included. N2 checks this algebraic identity.
S09 · implies
Before
S=\{(-1,1),(0,0),(1,1)\},\ p\equiv\tfrac13After
\text{a finite joint law with}\ Y=X^2\ \text{on}\ SConditions: none
Rule: mko_joint_def · Uses: G3, mko_joint_def
Leaf basis: mko_joint_def + cartesian_product_def + numeric_evaluation
The first coordinates −1, 0, 1 are distinct, so the pairs are distinct; each mass 1/3>0; the total is 3·(1/3)=1. So it is a finite joint law. In each pair the second coordinate is the square of the first, (−1)²=1, 0²=0, 1²=1, so Y=X² on this law.
S10 · equivalent
Before
E[X]=\tfrac13(-1)+\tfrac13(0)+\tfrac13(1)
After
E[X]=0
Conditions: none
Rule: numeric_evaluation · Uses: S01, S09
Leaf basis: numeric_evaluation + frac_rules
By definition E[X]=Σ p(s)X(s); the X values of the three pairs are −1, 0, 1, each times 1/3, adding to 0.
S11 · equivalent
Before
E[Y]=\tfrac13(1)+\tfrac13(0)+\tfrac13(1)
After
E[Y]=\tfrac23
Conditions: none
Rule: numeric_evaluation · Uses: S01, S09
Leaf basis: numeric_evaluation + frac_rules
The Y values of the three pairs are 1, 0, 1, with weighted sum 2/3.
S12 · equivalent
Before
E[XY]=\tfrac13(-1)(1)+\tfrac13(0)(0)+\tfrac13(1)(1)
After
E[XY]=0
Conditions: none
Rule: numeric_evaluation · Uses: S01, S09
Leaf basis: numeric_evaluation + frac_rules
XY takes the values −1, 0, 1 on the three pairs (it equals X³), with weighted sum 0. E[XY] is computed pair by pair on the same joint law, not as E[X]E[Y].
S13 · equivalent
Before
\operatorname{Cov}(X,Y)=E[XY]-E[X]E[Y]After
\operatorname{Cov}(X,Y)=0-0\cdot\tfrac23=0Conditions: none
Rule: eq_replace · Uses: S01, S10, S11, S12
Leaf basis: eq_replace + numeric_evaluation
Substitute the three values of S10 to S12: 0−0·(2/3)=0. The covariance of this example is zero.
S14 · implies
Before
X,\ Y\ \text{independent on}\ (S,p)After
E[XY]=E[X]E[Y],\ \operatorname{Cov}(X,Y)=0Conditions: P(X=x,Y=y)=p_X(x)p_Y(y)\ \text{for all}\ (x,y)\in S_X\times S_Y
Rule: L_indep_prod · Uses: S01, G1
Leaf basis: L_indep_prod + eq_replace + add_inverse
Lemma L_indep_prod (proved in S14.1 to S14.3) gives E[XY]=E[X]E[Y], and S01 then gives Cov(X,Y)=0. This is the basis of the first half of MKO assumption a2.
S15 · equivalent
Before
X,Y\ \text{independent}\Rightarrow\operatorname{Cov}(X,Y)=0After
\operatorname{Cov}(X,Y)\neq 0\Rightarrow X,Y\ \text{not independent}Conditions: none
Rule: contrapositive · Uses: S14
Leaf basis: contrapositive
Take the contrapositive of S14: computing a nonzero covariance refutes independence. This is the first half of MKO assumption a2.
S16 · implies
Before
P(X=0,Y=1)\ \text{vs}\ P(X=0)\,P(Y=1)After
0\neq\tfrac13\cdot\tfrac23=\tfrac29
Conditions: none
Rule: mko_indep_def · Uses: S09, marginal_def, mko_indep_def
Leaf basis: mko_indep_def + marginal_def + numeric_evaluation
(0,1)∉S, so P(X=0,Y=1)=0. P(X=0)=p(0,0)=1/3 and P(Y=1)=p(−1,1)+p(1,1)=2/3, with product 2/9≠0. Independence requires equality at every pair; it fails at this pair, so X and Y are not independent.
S17 · implies
Before
\operatorname{Cov}(X,Y)=0\ \text{and}\ X,Y\ \text{dependent}After
\operatorname{Cov}(X,Y)=0\not\Rightarrow X,Y\ \text{independent}Conditions: none
Rule: exists_intro · Uses: S13, S16, S14
Leaf basis: exists_intro + quantifier_negation
On one joint law, Cov(X,Y)=0 (S13) while X and Y are not independent (S16). So the universal claim 'on every finite joint law, zero covariance gives independence' is false; the converse of S14 fails. This is the second half of MKO assumption a2.
Substeps and lemmas
S03.1 · equivalent
Before
\sum_{s\in S}p(s)\sum_{k=1}^{m}c_kU_k(s)After
\sum_{k=1}^{m}c_k\sum_{s\in S}p(s)\,U_k(s)=\sum_{k=1}^{m}c_k\,E[U_k]Conditions: S\ \text{finite}
Rule: finite_sum_rules · Uses: G1, distributive, finite_sum_rules
Leaf basis: distributive + finite_sum_rules + mul_comm + mul_assoc
Distribute p(s) into the inner sum to get a double finite sum; the order of finite summation may be exchanged (repeated use of Σ(a_i+b_i)=Σa_i+Σb_i), and the constant c_k comes out (Σ c·a_i=c·Σa_i). Each Σ_s p(s)U_k(s) is E[U_k] by definition. All sums are finite, so there is no convergence issue.
S03.2 · equivalent
Before
E[c]=\sum_{s\in S}p(s)\,cAfter
E[c]=c\sum_{s\in S}p(s)=cConditions: \sum_{s\in S}p(s)=1
Rule: finite_sum_rules · Uses: G1, finite_sum_rules
Leaf basis: finite_sum_rules + mul_one + mul_comm
The expectation of the constant function c: pulling out c leaves Σ_s p(s), which is exactly 1 by G1, so E[c]=c. If the masses only approximately summed to 1, this step would fail. S03.1 and S03.2 together prove Lemma L_lin_exp.
S14.1 · equivalent
Before
E[XY]=\sum_{(x,y)\in S}xy\,p(x,y)After
E[XY]=\sum_{x\in S_X}\sum_{y\in S_Y}xy\,P(X=x,Y=y)Conditions: S\subseteq S_X\times S_Y
Rule: finite_sum_regroup · Uses: G1, marginal_def, finite_sum_regroup
Leaf basis: finite_sum_regroup + mul_zero + add_zero
S_X and S_Y are the first and second coordinates occurring in S, so S⊆S_X×S_Y. On S, P(X=x,Y=y)=p(x,y); at grid points of S_X×S_Y outside S, P(X=x,Y=y)=0 and those terms are 0. Adding zero terms and regrouping by first coordinate leaves the finite sum unchanged.
S14.2 · implies
Before
\sum_{x\in S_X}\sum_{y\in S_Y}xy\,P(X=x,Y=y)After
\sum_{x\in S_X}\sum_{y\in S_Y}x\,p_X(x)\,y\,p_Y(y)Conditions: X,\ Y\ \text{independent}
Rule: mko_indep_def · Uses: S14.1, mko_indep_def
Leaf basis: mko_indep_def + eq_replace + mul_comm
Under the independence hypothesis every grid point (x,y), including points outside S, satisfies P(X=x,Y=y)=p_X(x)p_Y(y); substitute term by term and reorder the factors by commutativity.
S14.3 · equivalent
Before
\sum_{x\in S_X}\sum_{y\in S_Y}x\,p_X(x)\,y\,p_Y(y)After
\Big(\sum_{x}x\,p_X(x)\Big)\Big(\sum_{y}y\,p_Y(y)\Big)=E[X]\,E[Y]Conditions: none
Rule: distributive · Uses: S14.2, distributive, finite_sum_rules, finite_sum_regroup
Leaf basis: distributive + finite_sum_rules + finite_sum_regroup + mul_comm
In the inner sum over y the factor x p_X(x) is constant and comes out, giving x p_X(x)·Σ_y y p_Y(y); the outer sum then pulls out the constant Σ_y y p_Y(y), giving a product of two sums. Finally Σ_x x p_X(x)=Σ_x Σ_y x p(x,y)=Σ_{s∈S} X(s)p(s)=E[X] by regrouping by first coordinate, and likewise for E[Y]. S14.1 to S14.3 together prove Lemma L_indep_prod.
Error controls and negative controls
Zero covariance is not independence
The common mistake named by the MKO is to declare independence on seeing Cov=0. In this guide Y=X² is completely determined by X, yet Cov(X,Y)=0 (S13); the single pair (0,1) refutes independence (S16). S14 gives only the direction 'independent ⇒ Cov=0'.
All expectations must come from one joint law
Take L1: (0,0) and (1,1) with 1/2 each; and L2: (0,0), (0,1), (1,0), (1,1) with 1/4 each. Both have marginals P(X=1)=P(Y=1)=1/2, but Cov=1/2−1/4=1/4 on L1 and Cov=1/4−1/4=0 on L2. So covariance is fixed by the joint law, not by the marginals; mixing E[XY] from L2 with E[X], E[Y] from L1 gives a number unrelated to L1.
The affine rule: constants vanish, coefficients multiply
In S08, b and d vanish completely and a, c appear as the product ac with the sign kept. For example Cov(2X+1,−3Y+5)=−6·Cov(X,Y), not 6·Cov(X,Y) and not −6·Cov(X,Y)+5. N10 and N11 check this on the example with U=2X+1 and V=−3X+5: the direct computation agrees with 2·(−3)·Cov(X,X)=−4.
- In the example Cov(X,Y)=0, so X and Y are independent →
reject — P(X=0,Y=1)=0 but P(X=0)P(Y=1)=2/9. - Cov(2X+1,−3Y+5)=6·Cov(X,Y)+5 →
reject — By S08 it equals 2·(−3)·Cov(X,Y)=−6·Cov(X,Y); the constants 1 and 5 do not appear. - Knowing the two marginal tables of X and Y suffices to compute Cov(X,Y) →
reject — L1 and L2 have the same marginals but covariances 1/4 and 0. - It is possible that X and Y are independent while Cov(X,Y)=1/5 →
reject — S14: on a finite joint law, independence implies Cov(X,Y)=0.