Find the determinant of a "piecewise" matrix Let $n$ be a positive integer, and $A_n$ is a $n \times n$ matrix, where the $(i,j)^\text{th}$ entry is $1$, if $i \leq j$ and it is $-1$ otherwise. What is the determinant of $A_n$?
My first thought is that it's similar to a piecewise function, and I found out that generally it's a weird "upper triangular" shape, where the diagonal and the lower part of the matrix is $1$, and the upper part of the matrix is $-1$. Where should I proceed? I plan on doing some row manipulation and maybe have a matrix in RREF, which is easy since it's all just one. Should the determinant be $1$?
 A: Let $A$ be the $n \times n$ matrix given by
\begin{align*}
a_{ij} = \begin{cases} 1 & \text{if } i \leq j \\ -1 & \text{otherwise} \end{cases}.
\end{align*}
Then, $\det{A} = \det{B}$ where the matrix $B$ is such that
\begin{align*}
b_{ij} = \begin{cases} 1 & \text{if } i = 1 \\ 2 & \text{if } i \neq 1 \wedge i \leq j \\ 0 & \text{otherwise} \end{cases}.
\end{align*}
This is true because you can add the first row to all the other $n-1$ rows and the determinant will be the same. Next, note that $B$ is a triangular matrix and the entries of the diagonal are such that
\begin{align*}
b_{ii} = \begin{cases} 1 & \text{if } i = 1 \\ 2 &\text{otherwise} \end{cases}.
\end{align*}
Therefore,
\begin{align*}
\det{A} & = \det{B} \\
& = 1 \times \prod_{i=2}^n 2 \\
& = 2^{n-1}. & \square
\end{align*}
A: I think it would be good to do row manipulations. If I am not wrong, the upper part of the matrix (including the diagonal) has the positive $1$ elements. Then we can add the first row to the $i$-th row for $i=2, \dots, n$. We will get a matrix of following form:
$$\begin{pmatrix}
1 & 1&1&...&1\\
0 & 2&2&...&2\\
\vdots & \ddots& \ddots &...&\vdots\\
0 & 0&0&...&2\\
\end{pmatrix}$$
These row manipulations don't change the determinant and the determinant of the resulting matrix is obviously $\det(A) = 2^{n-1}$.
