# I want to visualize the matrix rank function

Is there a way to plot/graph/visualize the non-convex nature of the rank function of a matrix? thank you

-

Well, you can look at low-dimensional examples. Try $$A = \pmatrix{1 & 1 & 1\cr x & 1 & 1\cr 1 & y & 1\cr}$$
This has rank $1$ for $x=y=1$, rank $3$ if $x \ne 1$ and $y \ne 1$, rank $2$ if $x=1$ or $y=1$ but not both.
How about this: let $A$ be the $n \times n$ matrix whose entries are all $0$ except for the upper left entry, which is equal to $1$. Consider the restriction of the matrix rank function to the "line segment" joining $-A$ and $A$. The rank function is equal to $1$ at every point on this line segment, except at the midpoint where the rank is $0$ (the rank of the zero matrix).