Police are working to establish why a student opened fire on two of his classmates on Thursday, killing them before he himself died.