Expressing a piecewise modular function with a single expression

40 Views Asked by At

I have figured out that $$ \left\{ \begin{array}{ll} a(x) & \quad c(x) < 0 \\ b(x) & \quad c(x) > 0\ \end{array} \right.=\frac{(c(x)-|c(x)|)(b(x)-a(x))}{2|c(x)|}+b(x) $$

as long as $$c(x)\neq0$$ (Please correct me if this is wrong!)

I would like to know if and/or how this extends to modular arithmetic, i.e. expressing a piecewise modular function as a single equation. I am completely new to modular, so please keep that in mind when answering. Thanks for your time!