Refer to the diagram shown below.
Calculate the slope of line segment AB as m₁.

Calculate the slope of line segment BC as m₂.

The product of the slopes of perpendicular lines is equal to -1.
Therefore

The equation that relates p and q is p+q = 7
Answer: p + q = 7