Area of surface over $xy$-plane In my calculus book, it is claimed that the area $dS$ below, can be expressed as $$\frac{1}{\cos\gamma}dxdy.$$
Here $\vec{n}$ is perpendicular to the surface element, and $\vec{k}$ is given as $(0,0,1)$.
I understand how this can be concluded if either the area element's $x$- or $y$-component is parallell to the coordinate system. I do however have a hard time seeing how this can be concluded if the element is tilted in both the $x$ and $y$-direction.
Any tips on how this can be shown?


WLOG we can translate things around so that the base of our rectangular prism has vertex $(0, 0, 0), (a, 0, 0), (0, b, 0), (a, b, 0)$ and $(0, 0, 0)$ is the vertex with the smallest $z$-coordinate where the plane cut the rectangular prism.
Also, WLOG we can assume our normal vector $n = \begin{pmatrix} p \\ q \\ r \end{pmatrix}$ has length $|n| = 1$.
With this setup, all we need to do is to find the other 2 vertices $(a, 0, z_1), (0, b, z_2)$ where the plane cut the rectangular prism. Since the cross section is a parallelogram, the area is then simply the length of the cross product of the position vectors of the 2 vertices.
This is the hint part. You can stop reading now and try to solve it yourself.

Since $\gamma$ is the angle between the $k = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}$ and $n$, by the property of dot product, $\cos \gamma = |k||n| \cos \gamma = k \cdot n = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \cdot \begin{pmatrix} p \\ q \\ r \end{pmatrix} = r$
From now on, we can write $n = \begin{pmatrix} p \\ q \\ \cos \gamma \end{pmatrix}$
Observe $1 = |n| = \sqrt{p^2 + q^2 + \cos^2 \gamma}$
Therefore $p^2 + q^2 + \cos^2 \gamma = 1$ and hence $$p^2 + q^2 = 1 - \cos^2 \gamma = \sin^2 \gamma$$
Since the plane cut the rectangular prism at $(0, 0, 0)$, it passes throught the origin. Hence we can write its equation as $$\begin{pmatrix} p \\ q \\ \cos \gamma \end{pmatrix} \cdot \begin{pmatrix} x \\ y \\ z \end{pmatrix} = 0$$ which is the same as $px + qy + (\cos \gamma)z = 0$.
As the plane cut through the rectangular prism at vertice $(a, 0, z_1)$, the vertice satisfies the equation of the plane. Therefore, $p a + q 0 + (\cos \gamma)z_1 = 0$ and hence $$z_1 = -\frac{pa}{\cos \gamma}$$
Similarly, at vertice $(0, b, z_2)$, we have $p 0 + q b + (\cos \gamma)z_2 = 0$ and hence $$z_2 = -\frac{qb}{\cos \gamma}$$
With these two $z$-coordinates, we now know the position vectors of the 2 vertices are $\begin{pmatrix} a \\ 0 \\ -\frac{pa}{\cos \gamma} \end{pmatrix}$ and $\begin{pmatrix} 0 \\ b \\ -\frac{qb}{\cos \gamma} \end{pmatrix}$.
Since $(0, 0, 0)$ is the vertex with the smallest $z$-coordinate where the plane cut the rectangular prism, these 2 position vectors are the sides of the parallelogram.
Now area $$\begin{align*} A
&= \left| \begin{pmatrix} a \\ 0 \\ -\frac{pa}{\cos \gamma} \end{pmatrix} \times \begin{pmatrix} 0 \\ b \\ -\frac{qb}{\cos \gamma} \end{pmatrix} \right| \\
&= \left| \det \begin{pmatrix}
i & j & k \\
a & 0 & -\frac{pa}{\cos \gamma} \\
0 & b & -\frac{qb}{\cos \gamma}
\end{pmatrix} \right| \\
&= \left| i \det \begin{pmatrix}
0 & -\frac{pa}{\cos \gamma} \\
b & -\frac{qb}{\cos \gamma}
\end{pmatrix} - a \det \begin{pmatrix}
j & k \\
b & -\frac{qb}{\cos \gamma}
\end{pmatrix}\right| \\
&= \left| \frac{pab}{\cos \gamma} i - a \left( -\frac{qb}{\cos \gamma} j - bk \right) \right| \\
&= \left| \frac{pab}{\cos \gamma} i + \frac{qab}{\cos \gamma} j + ab k \right| \\
&=  \sqrt{\frac{p^2 a^2 b^2}{\cos^2 \gamma} + \frac{q^2 a^2 b^2}{\cos^2 \gamma} + a^2 b^2} \\
&= a b \sqrt{\frac{p^2}{\cos^2 \gamma} + \frac{q^2}{\cos^2 \gamma} + 1} \\
&= ab \sqrt{\frac{p^2 + q^2}{\cos^2 \gamma} + 1} \\
&= ab \sqrt{\frac{\sin^2 \gamma}{\cos^2 \gamma} + 1} \\
&= ab \sqrt{\tan^2 \gamma + 1} \\
&= ab \sqrt{\sec^2 \gamma} \\
&= ab \sec \gamma \\
&= \frac{ab}{\cos \gamma}
\end{align*}$$
which is exactly what we want to show.
