A Solution to The Elements of Statistical Learning Ex 4.3
Editing: I have posted this answer to the ESL-CN github repo and the author points out that the original solution has incorrectly treated $B$ as an invertible matrix at some point. I have corrected the appropriated place that has this error.