Beamer: matrix with different properties for first row

I want to have a slide that looks as follows:

• At the top, I'd like to have a theorem statement in a tcbtheorem environment I've defined.
• Below that, I'd like, after some vertical spacing, two columns of the following form.
• The first row must have each element be a tcolorbox of the form I've defined; further, each of these should be able to hold a couple of lines of text in them, while not getting too wide (so they might have somewhat larger height than a box that has only line of text).
• The subsequent rows should be tcolorboxes with a more plain look than those in the first row (I'd like to be able to customize these; so essentially, I'm asking for a different style in these rows).
• I want the entire matrix to be revealed in the order: (row1, col1), (row1, col2), (row2, col1), (row2, col2), etc.

So far, I've managed to achieve very few of these goals. I'd really appreciate any help.

\documentclass{beamer}
\mode<presentation>
{
\setbeamertemplate{caption}[numbered]
}

\usepackage{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{matrix,overlay-beamer-styles}

%%%%%%%%%
\usetikzlibrary{calc}
%%%%%%%%
\tcbuselibrary{theorems}

\newtcbtheorem[]{mylemmma}{Lemma}{colframe=green,colback=white, width=\textwidth}{lem}
\tcbset{colframe=green, colback=white}
\resetcounteronoverlays{tcb@cnt@mylemmma}

\begin{document}
\section{Proofs}
\newtcbtheorem[]{mydef}{Problem Statement}{colframe=white, colback=white}{ps}
\tcbset{colframe=black, colback=white}

\resetcounteronoverlays{tcb@cnt@mydef}

\begin{frame}[fragile]
\begin{mylemmma}{theorem title}{thm}
For any fixed iteration,
$f(x+a)\approx f(x) + f'(x)(a) + 1/2 f''(z) (a^2)$
\end{mylemmma}

\centering
\begin{tikzpicture}[optimization problem/.style = {%
rounded corners,
draw = blue,
thick,
fill= white,
inner ysep=5pt,
inner xsep=5pt,
align = center},
]

\matrix[matrix of nodes,row sep=1em,column sep=1em,
nodes={anchor=west,
visible on=<\pgfmatrixcurrentrow->,},
column 1/.style={nodes={optimization problem,
}},
column 2/.style={nodes={optimization problem,
alt=<-\the\numexpr\pgfmatrixcurrentcolumn-1>{opacity=0,text opacity=0}{},
}}](M){
vectors   &  matrices\\
reason 1    & matrix reason 1\\
reason 2    & matrix reason 2\\
};

\end{tikzpicture}

\end{frame}

\end{document}



I am a big fan of one question per question, so this answer focuses on the last question because the answer is very simple.;-) The answer is

 visible on=<\the\numexpr-2+\pgfmatrixcurrentcolumn+2*\pgfmatrixcurrentrow\relax->


(where I added a -2 thanks for your comment!) or, in more detail,

\documentclass{beamer}
\mode<presentation>
{
\setbeamertemplate{caption}[numbered]
}

\usepackage{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{matrix,overlay-beamer-styles}

%%%%%%%%%
\usetikzlibrary{calc}
%%%%%%%%
\tcbuselibrary{theorems}

\newtcbtheorem[]{mylemmma}{Lemma}{colframe=green,colback=white, width=\textwidth}{lem}
\tcbset{colframe=green, colback=white}
\resetcounteronoverlays{tcb@cnt@mylemmma}

\begin{document}
\section{Proofs}
\newtcbtheorem[]{mydef}{Problem Statement}{colframe=white, colback=white}{ps}
\tcbset{colframe=black, colback=white}

\resetcounteronoverlays{tcb@cnt@mydef}

\begin{frame}[fragile]
\begin{mylemmma}{theorem title}{thm}
For any fixed iteration,
$f(x+a)\approx f(x) + f'(x)(a) + 1/2 f''(z) (a^2)$
\end{mylemmma}

\centering
\begin{tikzpicture}[optimization problem/.style = {%
rounded corners,
draw = blue,
thick,
fill= white,
inner ysep=5pt,
inner xsep=5pt,
align = center},
]

\matrix[matrix of nodes,row sep=1em,column sep=1em,
nodes={anchor=west,optimization problem,
visible on=<\the\numexpr-2+\pgfmatrixcurrentcolumn+2*\pgfmatrixcurrentrow\relax->,},
](M){
vectors   &  matrices\\
reason 1    & matrix reason 1\\
reason 2    & matrix reason 2\\
};

\end{tikzpicture}

\end{frame}
\end{document}


How does that work? First of all, in tikzlibrarymatrix.code.tex you can find a couple of nice keys and objects which have not made their way to the pgfmanual yet. In this answer, the important ones are

• \pgfmatrixcurrentcolumn, a TeX count, which indicates the column of the cell, and
• \pgfmatrixcurrentrow, a TeX count indicating the row of the column.

Apart from that, you can find the keys

• execute at end matrix,
• execute at begin cell,
• execute at end cell,
• execute at empty cell,

which are hooks that can be used to fill matrices automatrixally. In the above,

visible on=<\the\numexpr-2+\pgfmatrixcurrentcolumn+2*\pgfmatrixcurrentrow\relax->


uses the visible on key from the overlay-beamer-styles library. The combination is chosen such that for overlay number 1 the cell 11 becomes visible since -2+column+2*row=1 for column=row=1, for overlay number 2 cell 12 becomes visible since -2+column+2*row=2 for column=2 and row=1, and so on. If you have a matrix with 7 columns, say, you will need thus

 visible on=<\the\numexpr-7+\pgfmatrixcurrentcolumn+7*\pgfmatrixcurrentrow\relax->


• @lazulikid The relevant objects are not really documented in the manual. One can find them in the library. (I was supposed to write an article on this, but even though the article is more or less ready, it never got published.) However, \pgfmatrixcurrentcolumn and \pgfmatrixcurrentrow have a very simple interpretation: the column or row index of the matrix entry. There are many more useful keys. I understand and appreciate your desire to understand these things better. But this really can only be achieved with one question at a time... – user194703 May 25 '20 at 22:51