# Matrix or Table with uneven number of columns

I want to achieve something like following:

Is there a way to achieve this in latex? Thanks for your help.

-
Please post a Minimal Working (or Non-Working) Example. If you show people what you've tried and explain the problem you've run into, it will be a lot easier for people to help. A MWE is a small document which people can compile to reproduce the issue you're having or, if applicable, can try to compile to reproduce the errors you're getting. Providing this will help ensure you get useful responses. –  cfr Feb 4 at 3:51

Given what you provide, blkarray can do this job:

\documentclass{article}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\idxsize}{\scriptstyle}
\begin{document}
$\begin{blockarray}{crcc} & & \rlap{\phantom{0}\hspace{.5\arraycolsep}\idxsize j} & \\ & & \idxsize 0 & \idxsize 1 \\ \begin{block}{cr[cc]} \relax\raisebox{-.5\normalbaselineskip}[0pt][0pt]{\idxsize j-1} & \idxsize 0 & a & b \\ & \idxsize 1 & c & d \\ \end{block} \end{blockarray}$
\end{document}


More matrix-style constructions is available in Where is the \matrix command?

-

A second alternative via tikz-cd

Code

\documentclass[margin=10pt,varwidth]{standalone}

\usepackage{amssymb,amsmath}
\usepackage{tikz-cd}
\begin{document}

\begin{tikzcd}[row sep=tiny,column sep=tiny]
&     &    &                    &   & j &    &\\
&     &    &                    & 0 &   & 1  &\\
&     &    & \arrow[draw=none]{}&   &   &    &\arrow[draw=none]{}\\
&     & 0  &                    & a &   & b  &\\
j-1  &     &    &                    &   &   &    &\\
&     & 1  &                    & c &   & d  &\\
&     &    & \arrow[dash]{uuuu} &   &   &    &\arrow[dash]{uuuu}\\
\end{tikzcd}

\end{document}

-