Here is the graph for Bonus Question for Homework 3. The graph shows that ε is orthogonal to the ŷ, and all other component.

library(rgl)
library(knitr)
knit_hooks$set(webgl=hook_webgl)

plot3d(c(0,3),c(0,5),c(0,3),type='l',xlim=c(0,5),ylim=c(0,5),zlim=c(0,5),box=F,col='blue',lwd=2,
       xlab='',ylab='',zlab='')#y
lines3d(c(0,3),c(0,4),c(0,4),col='red',lwd=2)#yhat
lines3d(c(0,2),c(0,2),c(0,2),col='green',lwd=3)#b0
lines3d(c(0,1),c(0,2),c(0,2),col='green',lwd=3)#b1x
lines3d(c(2,3),c(2,4),c(2,4),col='green',lwd=.5)
lines3d(c(1,3),c(2,4),c(2,4),col='green',lwd=.5)
lines3d(c(3,3),c(5,4),c(3,4),col='orange',lwd=2)#e
text3d(3.1,5.1,3.1,cex=1.5,adj=c(0.5,0.5),text='y')
text3d(3.1,4.1,4.1,cex=1.5,adj=c(0.5,0.5),text='yhat')
text3d(2.1,2.1,2.1,cex=1.5,adj=c(0.5,0.5),text='b0')
text3d(1.1,2.1,2.1,cex=1.5,adj=c(0.5,0.5),text='bx')
text3d(3.1,4.2,3.5,cex=1.5,adj=c(0.5,0.5),text='e')

You must enable Javascript to view this page properly.