title: Is there general method to solve for a single unknown if the unknown variable changes?
body: <p>I have a simple algebraic relationship that uses three variables. I can guarantee that I know two of the three and need to solve for the third, but I don't necessarily know which two of the variables I will know. I'm looking for a single method or algorithm that can handle any of the cases without a huge batch of conditionals. This may not be possible, but I would like to implement it in a more general sense rather than code in every relationship in terms of the other variables.
  For example, if this were the relationship:</p>
  
  <pre><code>3x - 5y + z = 5
  </code></pre>
  
  <p>I don't want to code this:</p>
  
  <pre><code>function(int x, int y)
  {
    return 5 - 3x + 5y;
  }
  
  function(int x, int z)
  {
    return (5 - z - 3x)/(-5);
  }
  </code></pre>
  
  <p>And so on. Is there a standard sort of way to handle programming problems like this? Maybe using matrices, parameterization, etc?</p>