Exercise C22 in chapter VS: Find the dimension of the subspace \(W\) of \(P_3\), given by: \[ W = \{ a + bx + cx^2 + dx^3 \mid a + b + c + d = 0 \} \]

coeff_matrix <- matrix(c(1, 0, 0, -1,  # polynomial a - d
                         0, 1, 0, -1,  # polynomial b - d
                         0, 0, 1, -1), # polynomial c - d
                       nrow=3, ncol=4, byrow=TRUE)

svd_result <- svd(coeff_matrix)

rank <- sum(svd_result$d > 1e-10)  # I used a small threshold to account precision issues

print(rank)
## [1] 3