precept3sol

precept3sol - Computer Science 340 Reasoning About...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 340 Reasoning About Computation Precept 3 Problem 1 a) Prove that if X 1 and X 2 are independent random variables then E [ X 1 · X 2 ] = E [ X 1 ] E [ X 2 ]. b) Does E [ X 1 · X 2 ] = E [ X 1 ] E [ X 2 ] imply that X 1 and X 2 are independent random vari- ables? Solution: a) Let D 1 Z be the domain of X 1 and similarly D 2 be the domain of X 2 . According to the definition of expectation we know that: E [ X 1 ] E [ X 2 ] = ± X i D 1 i · Pr[ X 1 = i ] X j D 2 j · Pr[ X 2 = j ] ! = X i D 1 X j D 2 i · j · Pr[ X 1 = i ] · Pr[ X 2 = j ] Since X 1 , X 2 are independent we can proceed: = X i D 1 X j D 2 i · j · Pr[ X 1 = i ] · Pr[ X 2 = j | X 1 = i ] = X i D 1 X j D 2 i · j · Pr[ X 1 = i X 2 = j ] = X t D 1 D 2 t · X ( i,j ) D 1 × D 2 | i · j = t Pr[ X 1 = i X 2 = j ] = X t D 1 D 2 t · Pr[ X 1 · X 2 = t ] = E [ X 1 · X 2 ] b) Let us define random variables X 1 and X 2 as follows: ( X 1 , X 2 ) = ( - 1 , 0) , with probability 1 4 (1 , 0) , with probability 1 4 (0 , 1) , with probability 1 2 Then E [ X 1 ] = 1 4 · ( - 1) + 1 4 · 1 + 1 2 · 0 = 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
E [ X 2 ] = 1 4 · 0 + 1 4 · 0 + 1 2 · 1 = 1 2 E [ X 1 · X 2 ] = 1 4 · 0 + 1 4 · 0 + 1 2 · 0 = 0 Thus E [ X 1 · X 2 ] = E [ X 1 ] · E [ X 2 ] On the other hand, Pr( X 1 = 0) = 1 / 2, but Pr( X 1 = 0 | X 2 = 1) = 1, so X 1 and X 2 are not independent. Problem 2 Suppose you write the following C code to compute the maximum number stored in an array of size n : max = a[0]; for (int i = 1; i < n; i++) { if (max < a[i]) { max = a[i]; } } Assume that the array
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 01/29/2008 for the course COS 340 taught by Professor Charikarandchazelle during the Fall '07 term at Princeton.

Page1 / 6

precept3sol - Computer Science 340 Reasoning About...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online