# Uncoditional formula for unsigned area under a linesegment w.r.t. $y=0$

I'm interested in finding the unsigned area under a line segment with respect to $$y=0$$. The line segment is defined by start point $$(s_x, s_y)$$ and end point $$(e_x, e_y)$$

Without loss of generality, I translate the line segment along the $$x$$-axis, equating $$s_x$$ to $$0$$ and decreasing $$e_x$$ by $$s_x$$. The line equation then becomes:

$$l(x) = \frac{\textrm{rise}}{\textrm{run}}x + y\textrm{-intercept} = \frac{e_y-s_y}{e_x}x + s_y$$

In order to find the unsigned area under the curve, I take the definite integral of the absolute value of $$l$$:

$$A = \int_{0}^{e_x} |l(x)| dx = \int_{0}^{e_x} \left \lvert \frac{e_y-s_y}{e_x}x + s_y \right \rvert dx$$

I used an online tool (https://www.integral-calculator.com/, I believe it uses Maxima) to evaluate this integral (Wolfram Alpha was unable to compute it for free), and it evaluates to:

$$A = \frac{(e_y|e_y|-s_y|s_y|)e_x}{2(e_y-s_y)}$$

I've checked the answer for several values and this formula seems to be correct for all combinations of sign for the variables.

Now comes my problem. This formula has a discontinuity at $$e_y = s_y$$, which requires me to make this formula conditional. I can remove the discontintuity as follows:

If $$e_y = s_y \neq 0$$, the expression becomes:

$$A = \frac{(e_y^2-s_y^2)e_x}{2(e_y-s_y)}=\frac{(e_y-s_y)(e_y+s_y)e_x}{2(e_y-s_y)}=\frac{(e_y+s_y)e_x}{2}$$

which is just the familiar formula for the area of a quadrilateral.

My questions:

1. Is there an unconditional expression which covers all cases?
2. The formula is commutative in $$e_y$$ and $$s_y$$ (i.e. $$A(e_y, s_y) = A(s_y, e_y)$$ for all $$e_x$$). I would therefore suspect that this formula can be expressed by commutative operators (e.g. summation and multiplication). This conjecture is proven above for the case where $$e_y$$ and $$s_y$$ are of the same sign. Is this correct for the general problem?
• When translating along the $y$-axis, isn't it the $y$ coordinate that changes? Also, both points get translated, and the slope will still be \fract{e_y - s_y}{e_x - s_x}.$– Marwan Mizuri Apr 18 at 11:31 • @MarwanMizuri You're right, I meant "translating along the$x$-axis" (updated the question). Also added that$e_x$gets translated by the same amount. – user3072337 Apr 18 at 11:43 • @MarwanMizuri And yes, the slope is still$\frac{e_y - s_y}{e_x - s_x}$, but as$s_x = 0\$, it reduces to the form I mention. – user3072337 Apr 18 at 11:51