Finding a horizontal line that divides a modulus function's area into 2 equal halves 
How to find the horizontal line $y=k$ that divides the area of $y=2-\lvert x-2\rvert $ above the $x$-axis into two equal halves using Calculus?
I know of methods other than Calculus to solve this, but my question requires to solve it using Calculus (Definite Integration).
I've tried to solve it using calculus after watching youtube video solutions of the same type of question where the function of interest were parabolas or other curves. Still couldn't get to the right solution. I'm assuming I've made mistakes in taking the limits of integration as this an absolute value function and not a parabola.
How to solve this question using calculus? If there are ways to solve this by integrating the function with respect to $y$ (instead of $x$) which I have seen people doing while solving questions regarding parabola functions, then do let me know!
Note: I'm a high school senior who has been sitting with this problem since morning & I seriously cannot seem to get through and get over it. Helping me solve this question will broaden my knowledge of Calculus & will clear my misconceptions.
I've attached an image to the post as well.
The answer is $y=2-\sqrt{2}$
Thanks
 A: The area above the $x$ axis is
$$
A =\int_0^4 2 - \lvert x-2 \rvert \, \mathrm{d}x =  \int_0^2 2 -(2-x)\, \mathrm{d}x  + \int_2^{4}2 -(x-2) \, \mathrm{d}x  = 4 \tag{1}
$$
Now, if we draw a horizontal line $\color{green}{y=k}$ on top of the function $y= 2 - \lvert x-2 \rvert$ it splits the latter area in $2$ halves:

In the above diagram the line $\color{green}{y=k}$ is drawn in green, and the $2$ halves are drawn in $\color{orange}{\text{orange}}$ and $\color{blue}{\text{blue}}$ respectively. The question asked is

Find the horizontal line $\color{green}{y=k}$ that divides the area of $y= 2 - \lvert x-2 \rvert$ above the $x$-axis into two equal halves.

Which in the diagram above translates to finding a $k$ such that
$$
 \text{Area of }\color{orange}{\text{orange}} \text{ half}= \text{Area of }\color{blue}{\text{blue}} \text{ half} = \frac{A}{2} \overset{(1)}{=} \frac{4}{2} = 2 \tag{2}
$$
So now the question becomes writing the $\color{orange}{\text{orange}}$ and
$\color{blue}{\text{blue}}$ areas using calculus, then setting each of those equal to $2$, and then (hopefully) solving for $k$ from these equations using calculus techniques.

*

*We first calculate some key points relevant to calculating the $\color{orange}{\text{orange}}$ and $\color{blue}{\text{blue}}$  areas. Namely, what are the coordinates of the intersections of $y=k$ with $y = 2 - \lvert x-2 \rvert$?


 We achieve these coordinates by setting $y=k$ equal to $y = 2 - \lvert x-2 \rvert$ and solving for $k$ $$k = 2 - \lvert x-2 \rvert \implies \begin{cases} k = 2- (2-x) &\implies x = \color{purple}{k}\\ k = 2 -(x-2) & \implies x =\color{purple}{4-k} \end{cases}$$ 



*Once you have the coordinates, how can you write an integral for the area of the $\color{blue}{\text{blue}}$ half?


 We first notice that we can split the $\color{blue}{\text{blue}}$ region in $3$ parts: $A,B$ and $C$:  Each of these regions is an area between the $x$ axis and a function, so we can calculate each of the areas $A$, $B$ and $C$ as integrals as follows $$\color{blue}{\text{Blue}}\text{ area}=\underbrace{\int_0^k \color{red}{2-\lvert x-2\rvert}\, \mathrm{d}x}_{A} + \underbrace{\int_k^{4-k} \color{green}{k} \, \mathrm{d}x}_{B} +\underbrace{\int_{4-k}^4 \color{red}{2-\lvert x-2\rvert}\, \mathrm{d}x}_{C} \tag{3}$$



*Since equation $(2)$ tells us that $\color{blue}{\text{Blue}}\text{ area} = 2$, how can we combine this with the previous step to get an equation for $k$?


 Since $\color{blue}{\text{Blue}}\text{ area} = 2$, combining equations $(2)$ and $(3)$ we get \begin{align}&2 = \int_0^k 2-\lvert x-2\rvert\, \mathrm{d}x + \int_{k}^{4-k} k \, \mathrm{d}x + \int_{4-k}^4 2-\lvert x-2\rvert\,  \mathrm{d}x \\ \implies & 2 = \int_{0}^{k} x \, \mathrm{d}x + k((4-k) -k) + \int_{4-k}^{4} 4-x\, \mathrm{d}x  \\ \overset{\color{purple}{u = 4-x}}{\implies} & 2 = \frac{k^2}{2} + 4k - 2k^2 + \int_{0}^{k} \color{purple}{u}\, \mathrm{d}\color{purple}{u} \\ \implies & 2 = - \frac{3}{2} k^2 + 4k + \frac{k^2}{2} \\ \implies & 2 =  4k -k^2\end{align}



*How can we solve the previous equation to obtain a value for $k$?


 Since the previous equation is a quadratic equation in $k$, it can be solved using the quadratic formula. We thus get \begin{align} &2 =  4k -k^2 \\ \implies & k^2 - 4k +2 =0 \\ \implies & k = \frac{4 \pm \sqrt{16 - 4(1)(2)}}{2} = \frac{4 \pm \sqrt{2 \cdot 2^2}}{2} = \frac{4 \pm 2\sqrt{2 }}{2} = 2 \pm \sqrt{2} \end{align} Now, for the line $y=k$ to split the function $y= 2 - \lvert x - 2\rvert$ into the $\color{orange}{\text{orange}}$ and $\color{blue}{\text{blue}}$ halves from the first diagram, $k$ must be between $0$ and $2$ since $2$ is the highest $y$ value of $y= 2 - \lvert x - 2\rvert$. Out of the two possibilities of sign choice in $2 \pm \sqrt{2}$ only $2 - \sqrt{2}$ is between $0$ and $2$, so we can conclude that the value of $k$ we want is $$ \boxed{y = k = 2 - \sqrt{2}}$$

