draft solution

calculation m coefficient, and calculate diagonal solution matrix