An optimal piecewise linear continuous fit to a given set of n data points D in two dimensions consists of a continuous curve defined by k linear segments which minimizes a weighted least squares error function. A key difficulty here is the fact that the linear segment Lj, which approximates a subset of consecutive data points Dj in an optimal solution, is not necessarily an optimal fit in itself for the points Dj. We solve the problem for the special case k=2 by showing that an optimal solution essentially consists of two least squares linear regression lines in which the weight wj of some data point (xj, yj) is split into the two weights, for computations of these lines. This gives an algorithm of worst-case complexity O(n) for finding an optimal solution for the case k=2.