How to solve linear equation using two points?