All problems
Variance of Independent Linear Combination
Problem
For independent X and Y, Var(a X + b Y) = a^2 Var(X) + b^2 Var(Y).
Given a, Var(X), b, and Var(Y), return the variance.
Hint
Square the coefficients so sign does not matter.
Test cases
case 1
in: [2,1,3,1]
expected: 13
case 2
in: [1,4,-1,2]
expected: 6
case 3
in: [0.5,8,0,5]
expected: 2
Starter codePython
def variance_of_independent_linear_combination(a, var_x, b, var_y):
# Your code here
pass3 test cases · run your code against them in the editor