  We prove that the functor of noncommutative deformations of every flipping or
flopping irreducible rational curve in a 3-fold is representable, and hence
associate to every such curve a noncommutative deformation algebra. This new
invariant extends and unifies known invariants for flopping curves in 3-folds,
such as the width of Reid, and the bidegree of the normal bundle. It also
applies in the settings of flips and singular schemes. We show that the
noncommutative deformation algebra is finite dimensional, and give a new way of
obtaining the commutative deformations of the curve, allowing us to make
explicit calculations of these deformations for certain (-3,1)-curves.
  We then show how our new invariant also controls the homological algebra of
flops. For any flopping curve in a projective 3-fold with only Gorenstein
terminal singularities, we construct an autoequivalence of the derived category
of the 3-fold by twisting around a universal family over the noncommutative
deformation algebra, and prove that this autoequivalence is an inverse of
Bridgeland's flop-flop functor. This demonstrates that it is strictly necessary
to consider noncommutative deformations of curves in order to understand the
derived autoequivalences of a 3-fold, and thus the Bridgeland stability
manifold.
