title: Equations for 2 variable Linear Regression
body: <p>We are using a programming language that does not have a linear regression function in it. We have already implemented a single variable linear equation:</p>
  
  <blockquote>
    <p>y = Ax + B</p>
  </blockquote>
  
  <p>and have simply calculated the A and B coefficents from the data using a solution similar to <a href="https://stackoverflow.com/questions/364558/find-a-best-fit-equation#364585">this Stack Overflow answer</a>.</p>
  
  <p>I know this problem gets geometrically harder as variables are added, but for our purposes, we only need to add one more:</p>
  
  <blockquote>
    <p>z = Ax + By + C</p>
  </blockquote>
  
  <p>Does anyone have the closed form equations, or code in any language that can solve for A, B and C given an array of x, y, and z's?</p>