title: Quadratic Bezier Curve: Calculate t given x
body: <p>Good day. I am using a Quadratic Bezier Curve with the following configurations:</p>
  
  <p>Start Point P1 = (1, 2)
  Anchor Point P2 = (1, 8)
  End Point P3 = (10, 8)</p>
  
  <p>I know that given a t, I know I can solve for x and y using the following equation: </p>
  
  <pre><code>t = 0.5; // given example value
  x = (1 - t) * (1 - t) * P1.x + 2 * (1 - t) * t * P2.x + t * t * P3.x;
  y = (1 - t) * (1 - t) * P1.y + 2 * (1 - t) * t * P2.y + t * t * P3.y;
  </code></pre>
  
  <p>where P1.x is the x coordinate of P1, and so on.</p>
  
  <p>What I've tried now is that given an x value, I calculate for t using wolframalpha and then I plug that t in to the y equation and I get a my x and y point. </p>
  
  <p>However, I want to automate finding t and then y. I have a formula to get x and y given a t. However, I don't have a formula to get t based on x.  I'm a bit rusty with my algebra and expanding the first equation to isolate t doesn't look too easy. </p>
  
  <p>Does anyone have a formula to get t based on x? My google search skills are failing me as of now.</p>
  
  <p>I think it's also worth noting that my Bezier curve faces right.</p>
  
  <p>Any help will be very much appreciated. Thanks.</p>