A=distance from pen to first pin B=distance of pen to second pin D=distance between pins 
We conclude that A+B+D must always be equal to the total length
of our string. If we denote this string length by S,
then we can write A+B+D=S, or
Of course only A and B change as we trace out the ellipse  S and D remain fixed. Our equation thus shows that for all points on the ellipse, the sum of the distances to two fixed points (i.e. the pins) is a constant. In fact this is one way that an ellipse is defined:

Different looking ellipses correspond to different choices for
This description of an ellipse is not the most useful if we want to get detailed information about the ellipse such as the total length around its perimeter or the total area it encloses. For this level of detail we need to introduce the idea of coordinates to describe all points in a flat 2dimensional plane. The coordinates we need are called Cartesian coordinates, in honour of their inventor, René Descartes.
Imagine that our ellipse lies in a flat plane. On this plane we can draw two straight lines which intersect at right angles. Call one of these lines the xaxis, and call the other one the yaxis (it's not too important which is which). Call the point where the intersect the origin, and label it with the pair (0,0). For any other point in the plane, measure its perpendicular distance to the two axes, and call these x and y, as in the diagram. Label the point by the pair (x,y). These are called the Cartesian coordinates of the point. You can think of them as giving the address of the point (``to get to point (x,y), start at the origin, go a distance x along the xaxis, then go a distance y parallel to the yaxis. You can't miss it.'')
Our goal is to use Cartesian coordinates to get a convenient
description of all the points lying on an ellipse.
Given an ellipse, we can locate the coordinate axes anywhere we
find convenient relative to the ellipse.
As you'll see, it makes sense to draw the xaxis through the two
foci of the ellipse, and to put the yaxis exactly midway between them,
as in the diagram. If the distance between the foci is D,
then their Cartesian coordinates will be (D/2,0) for the one
and (+D/2, 0) for the other. Now consider any point on the ellipse,
and denote its coordinates by (x,y). By the definition of an ellipse,
we know that
Before we can go any further, we need to understand how
to compute the distance between any two points.
Suppose the points have coordinates (x,y) and (a,b). Then
If we apply this to our point on the ellipse,
then the defining condition tells us that
We can rearange this to read
Squaring both sides of this equation then leads to the formula
