Place a 90-degree elbow onto the main PVC pipe at the location you want to start an expansion joint. Place a length of schedule 40 PVC pipe from this first 90-degree elbow to a second 90-degree elbow. The length of this pipe should be "B."
Extend a second piece of PVC pipe from the second elbow to a third elbow. The length of this pipe will be "A." From the third elbow, extend a third piece of PVC pipe, for length "B," to a fourth elbow that will connect back to the main pipe.
Calculate the length of pipes "A" and "B." The length of "A" equals 0.72 times the square root of the pipe outside diameter times the thermal expansion of the pipe in inches. The length of "B" uses the same formula, except the 0.72 is replaced by 1.44. Once the pipes are cut to length, use PVC cement to connect the pipes together.