I have a decision (detection) problem trying to decide between symbols ${0,2}$. I have the two probability density functions: $$ f(z|s=0) = \begin{cases} 0.25z + 0.5, & -2\le\ z <0 \\ -0.25z + 0.5, & 0\le\ z \le\ 2 \end{cases} $$
and $$ f(z|s=2) = \begin{cases} 0.25z, & 0\le\ z <2 \\ -0.25z + 1, & 2\le\ z \le\ 4 \end{cases} $$
How can i mathematically prove that the optimal threshold value $T$ for that decision problem is equal to $1$?
One tries to maximize the probability $\frac12R(T)$ to guess right, where $$ R(T)=\int_{-\infty}^Tf(z\mid s=0)\,\mathrm dz+\int_T^{+\infty}f(z\mid s=2)\,\mathrm dz. $$ Thus, $$ R'(T)=f(T\mid s=0)-f(T\mid s=2). $$ The function $R'$ is piecewise affine, $R'(T)=0$ if $T\lt-2$ or $T\gt4$, $R'(T)=\frac14T+\frac12$ if $-2\lt T\lt0$, $R'(T)=-\frac12T+\frac12$ if $0\lt T\lt2$, $R'(T)=\frac14T-1$ if $2\lt T\lt4$.
In particular, $R'(T)\gt0$ if $-2\lt T\lt1$ and $R'(T)\lt0$ if $1\lt T\lt4$. One sees that $R(T)$ is maximum at $T=1$.