# Paraboloid and Plane

Edit and compile if you like:

\documentclass{article}
%
% File name: paraboloid-plane.tex
% Description:
% A solid bounded by the following surfaces
% z = 0
% z = \sqrt{x^{2} + y^{2}}
% x^{2} + y^{2} + z^{2} = 1
% is generated. I.e., the intersection of paraboloid and a plane.
%
% Date of last modification: April, 23rd, 2022.
% Author: Efraín Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% According to TikZ.net
%
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{tikz-3dplot}
\usetikzlibrary{math}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1pt}
%
\begin{document}
%
\tdplotsetmaincoords{60}{130}
\begin{tikzpicture}[tdplot_main_coords,scale=0.75]
\tikzmath{function f(\x) {return \x;};}
\pgfmathsetmacro{\zini}{0.5*sqrt(2.0)}
\pgfmathsetmacro{\step}{0.01}
\pgfmathsetmacro{\zsig}{\zini+\step}
\pgfmathsetmacro{\nextz}{\zini+0.5*\step}
\pgfmathsetmacro{\sig}{2.0*\step}
\pgfmathsetmacro{\tini}{0.5*pi}
\pgfmathsetmacro{\tfin}{1.85*pi}
\pgfmathsetmacro{\tend}{2.5*pi}
%%% Coordinate axis
\draw[thick,->] (0,0,0) -- (3.5,0,0) node [below left] {\footnotesize$x$};
\draw[dashed] (0,0,0) -- (-2.5,0,0);
\draw[thick,->] (0,0,0) -- (0,3.5,0) node [right] {\footnotesize$y$};
\draw[dashed] (0,0,0) -- (0,-2.5,0);
\draw[thick] (0,0,0) -- (0,0,4.0); % Z axis (part under the plane z = 4)
% The region of integration
\draw[gray,thick,fill=yellow,opacity=0.35] plot[domain=0:6.2832,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{0.0});
%
\draw[gray,dash dot dot] (-2,0,0) -- (-2,0,4);
\draw[gray,dash dot dot] (0,-2,0) -- (0,-2,4);
% The plane: x + y = 2
\coordinate (A) at (2,2,4);
\coordinate (B) at (-2,2,4);
\coordinate (C) at (-2,-2,4);
\coordinate (D) at (2,-2,4);
% Curves bounding the solid.
\draw[blue,thick,opacity=0.5] plot[domain=-2:2,smooth,variable=\t] ({\t},0,{\t*\t});
\draw[blue,thick,opacity=0.5] plot[domain=-2:2,smooth,variable=\t] (0,{\t},{\t*\t});
\draw[blue,thick,opacity=0.5] plot[domain=0:6.2832,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{4.0});
% The paraboloid (level curves z = constant)
\foreach \altura in {\step,\sig,...,4.0}{
\pgfmathparse{sqrt(\altura)}
}
% The plane
\draw[white] (C) -- (B) node[red,above,sloped,midway]{$z = 4$};
\fill[pattern color=pink,pattern=north east lines] (A) -- (B) -- (C) -- (D) -- (A);
\draw[thick,red] (A) -- (B) -- (C) -- (D) -- (A);
%
\draw[gray,dash dot dot] (2,0,0) -- (2,0,4);
\draw[gray,dash dot dot] (0,2,0) -- (0,2,4);
%
\node[blue,left] at (1,-1.25,2.5) {$z = x^2 + y^2$};
\draw[thick,->] (0,0,4.0) -- (0,0,4.5) node [above] {\footnotesize$z$};
\end{tikzpicture}
\end{document}