1
$\begingroup$

Could anybody tell me that How one can generate a random singular matrices using matlab? I know that using rand(n) we can generate a random matrix of order n. But I found that these random matrices are non singular while I am interested in generating random singular matrices of higher order. Is there any command through which we can generate a random singular matrices? I need help.

Thanks a lot

$\endgroup$
2
$\begingroup$

If you're not too worried about the distribution of the matrix, you could just generate an $n-1 \times n$ matrix, and let the $n$th row be the sum of the others.

n = 3;
A = rand(n-1,n);
A(end+1,:) = sum(A);
$\endgroup$
  • $\begingroup$ Thanks for replying me. I don't understand about this A(end+1,:) = sum(A); ? $\endgroup$ – srijan Sep 16 '12 at 6:49
  • $\begingroup$ A(end,:) refers to the last row of the matrix $A$. Assigning a row to row end+1 is a quick way to append a row to the matrix. $\endgroup$ – Jacob Sep 16 '12 at 8:26
1
$\begingroup$

Another possibility is to take a random $n \times n$ matrix and adjust one entry to make the determinant $0$. This will be possible as long as the corresponding cofactor is not $0$, which is almost always the case.

$\endgroup$
  • $\begingroup$ Thank you very much sir. I have to think how to make code for that? $\endgroup$ – srijan Sep 16 '12 at 6:50
1
$\begingroup$

If the distribution of the points is not important, you can generate an $n\times n$ matrix with rank $k$ with the following pseudocode.

Generate a random matrix $R$ of dimension $n\times k$.
Set A=R*R^T.

Then $A$ will be an $n\times n$ matrix with rank $k$. This is due to the fact that $A$ is a series of $k$ outer products from the columns of $R$.

$\endgroup$
0
$\begingroup$

How are the entries of the matrix generated? Are they Bernoulli / Gaussian / uniform random variables? Whatever the PDF of each matrix entry, here's what you can do:

  1. Generate a random matrix.
  2. Check if matrix is singular.
  3. If singular, then use it. If not singular, discard it, and go back to 1.

Of course, you have to think about what "singular" means in MATLAB, for we're using floating-point numbers, not real numbers. Rank lower than eps would do, but it may be too conservative. You would wait a billion years until you found a singular random matrix.

$\endgroup$
  • $\begingroup$ entries of the matrices are uniformally generated. I was reading a research paper where author has taken numerical experiments performed on random singular matrices. I thought there must be some particular code but now I feel he might have taken rectangular singular matrices $\endgroup$ – srijan Sep 16 '12 at 7:01
  • $\begingroup$ @srijan: Is matrix singularity a concept that is applicable to rectangular matrices? Besides, if you're using uniform random variables and floating-point arithmetic, the probability of obtaining two linearly dependent rows or columns appears to be vanishingly small. $\endgroup$ – Rod Carvalho Sep 16 '12 at 7:06
  • $\begingroup$ You are taking me wrong. I don't mean there doesn't exist square singular matrices. As for as I know that a real random matrix has full rank with probability 1 and a rational random matrix has full rank with probability 1 too. Thats why i concluded so. I am sorry for that.:( $\endgroup$ – srijan Sep 16 '12 at 7:13
  • $\begingroup$ @srijan: Are the entries of the matrix independent random variables? Vectorize the $n \times n$ matrix and obtain a $n^2$ random vector. What is the correlation matrix of this random vector? $\endgroup$ – Rod Carvalho Sep 16 '12 at 7:22
  • $\begingroup$ If I were to referee a research paper that dealt with "random singular matrices", I would insist that the author specify the distribution or the method of generating those "random" matrices. $\endgroup$ – Robert Israel Sep 16 '12 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.