# How do we create an exercise environment like this:

In the following MWE, I used a newly defined tcolorbox for the text in teh upper left corner. The symbol is contained in the fontawesome5 package and can be ccessed through \faToggleOn. Spacing around the text, height, width and color of the box can of course be adjusted to suit your needs.

To get rid of the outer box's frame, I used boxrule=0pt, frame hidden, to get corners with a 90° angle instead of rounded corners, I added sharp corners.

\documentclass{article}
\usepackage{amssymb}
\usepackage{fontawesome5}
\usepackage[most]{tcolorbox}

\definecolor{mycolor}{RGB}{0,128,128}
\newtcbox{\mybox}{on line,
colback=mycolor,
fontupper=\bfseries\color{white},
boxrule=0pt,
arc=5pt,
boxsep=0pt,
left=2pt,
right=2pt,
top=5pt,
bottom=5pt}

\begin{document}

\begin{tcolorbox}[boxrule=0pt, frame hidden, sharp corners]

\mybox{\faToggleOn\; Câu 3}
Cho $x,y,z$ thỏa mãn $x^2+y^2+z^2=1.$ Chứng minh rằng
$\dfrac{x^2}{1+2yz}+\dfrac{y^2}{1+2zx}+\dfrac{z^2}{1+2xy}\geqslant \dfrac{3}{5}$

\end{tcolorbox}

\end{document}


Updated version that automatically numbers the boxes within their \section:

\documentclass{article}
\usepackage{amssymb}
\usepackage{fontawesome5}
\usepackage[most]{tcolorbox}

\definecolor{mycolor}{RGB}{0,128,128}

\newtcbtheorem[auto counter, number within=section,]{mycau}{\faToggleOn\; Câu}%
{enhanced jigsaw,%
sharp corners,%
boxrule=0pt,
frame hidden,%
colbacktitle= mycolor,
boxed title style={boxrule=0pt,
frame hidden,
boxsep=0pt,
top=5pt,
bottom=5pt,
left=2pt,
right=2pt,
arc=5pt},
attach boxed title to top left={xshift=0.5cm,yshift=-8mm},
fonttitle=\color{white}\bfseries,%
before upper=\hspace{2.5cm}
}{th}

\begin{document}

\begin{mycau}{}{label}
Cho $x,y,z$ thỏa mãn $x^2+y^2+z^2=1.$ Chứng minh rằng
$\frac{x^2}{1+2yz}+\frac{y^2}{1+2zx}+\frac{z^2}{1+2xy}\geqslant \frac{3}{5}$
\end{mycau}

\end{document}


The xcolor package, which is loaded automatically by the tcolorbox package, provides the macros \colorbox and \textcolor; they come in handy here.

\documentclass{article}
\usepackage[vietnamese]{babel}
\usepackage{amsmath,amssymb,tcolorbox,fontawesome5}

% optional: load suitable text and math fonts:
\usepackage{unicode-math}
\setmainfont{Fira Sans}
\setmathfont{Fira Math Regular}[Scale=MatchLowercase]

\begin{document}
\begin{tcolorbox}[boxrule=0pt]
\colorbox{teal}{\textcolor{white}{\bfseries\faToggleOn\ Câu 3}}
Cho $x,y,z$ thỏa mãn $x^2+y^2+z^2=1.$ Chứng minh rằng
$\frac{x^2}{1+2yz}+\frac{y^2}{1+2zx}+\frac{z^2}{1+2xy} \geqslant \frac{3}{5}$
\end{tcolorbox}
\end{document}


Inspired by the answers of @leandriis and @Mico here is how you could combine tcolorbox with an exercise package like xsim:

\documentclass{article}
\usepackage[vietnamese]{babel}
\usepackage[T1]{fontenc}
\usepackage[margin=2cm]{geometry}
\usepackage{amssymb}
\usepackage{fontawesome}
\usepackage[most]{tcolorbox}
\usepackage{xsim}

\DeclareExerciseEnvironmentTemplate{custom}{%
\begin{tcolorbox}[boxrule = 0pt]
\tcbox[on line,colback=teal,colframe=teal,coltext=white,size=small]{%
\faToggleOn\sffamily\bfseries\
\XSIMmixedcase{\GetExerciseName}
\GetExerciseProperty{counter}%
}{\hfill\textbf{Điện Biên}\end{tcolorbox}}

\xsimsetup{
exercise/template = custom ,
exercise/name = Câu
}

\begin{document}

\begin{exercise}
Cho $x,y,z$ thỏa mãn $x^2+y^2+z^2=1$. Chứng minh rằng
$\frac{x^2}{1+2yz}+\frac{y^2}{1+2zx}+\frac{z^2}{1+2xy} \geqslant \frac{3}{5}$
\end{exercise}

\end{document}