I want to write math questions and answers in the form of a book, which will be read by students. Can someone help me to create question, solution and tips environment, so that I could add the equations every time? Also I don't understand why my equations are cluttered.
I have attached an image about how the solution should look
\documentclass[12pt]{article}
%i have used few packages
\usepackage[margin= 1cm]{geometry}
\usepackage{amsmath}
\usepackage{tcolorbox}
\usepackage{multicol}
\usepackage{xcolor}
%document begins here
\begin{document}
%section heading
\section{Questions on Basic integration}
%question with bold and box
\begin{tcolorbox}
subsection begins here, the word question should be in bold
\subsection*{Question 1} Solve the following integral. $$\int \sec x(\sec x+\tan x) d x $$
\end{tcolorbox}
%solution word in bold
\subsubsection*{Solution}
this is a quick tip, to be highlighted
\textcolor{blue}{$$
\begin{array}{l}
\int \sec ^{2} x d x=\tan x \
\int \sec x \tan x=\sec x
\end{array}
$$}
%the solution
$$
\begin{aligned}
\int \sec x(&\sec x+\tan x) d x \
&=\int\left(\sec ^{2} x+\sec x \tan x\right) d x \
&=\int \sec ^{2} x d x+\int \sec x \tan x d x \
&=\tan x+\sec x+C
\end{aligned}
$$
%second question
\begin{tcolorbox}
%question 2 begins here
\subsection*{Question 2} Solve the following integral. $$\int \frac{1}{x+x\log x} dx$$
\end{tcolorbox}
%solution in bold
\subsubsection*{Solution}
\textcolor{blue}{$$
\begin{array}{l}
\text { Put } 1+x \log x=t \
\text { then, } \frac{1}{x}; d x=d t
\end{array}
$$}
% solution begins
\begin{center}$\displaystyle{
\begin{array}{l}
\int \frac{1}{x+x \log x} d x \
\text { Simce, } \frac{1}{x} d x=d t \text { and }(1+\log x)=t \
=\int \frac{d t}{t} \
=\log (t)+C \
=\int \log (1+\log x)+C
\end{array}
}$ \end{center}
\end{document}



$$to initiate and terminate display math mode in a LaTeX document. For more information on this subject, please see Why is\[ ... \]preferable to$$ ... $$? – Mico Mar 16 '21 at 16:03