# Thread:

1. ## Generate a random matrix given a condition number

If I am given the condition number , how can i generate a random matrix with that condition number. The matrix can have any number of rows and columns. please help...

2. The "condition number" of a matrix, A, is defined as [tex]||A||||A^{-1}|| For symmetric matrices, this is equal to $\frac{\lambda_{max}}{\lambda_{min}}$ where $\lambda_{max}$ is the largest eigenvalue and $\lambda_{min}$ is the smallest.

So the simplest thing to do to take a diagonal matrix with appropriate numbers on the diagonal. For example, if the condition number is to be 3/2, a matrix with that condition number is
$\begin{bmatrix}3 & 0 \\ 0 & 2\end{bmatrix}$.

If you wanted 3 by 3 or 4 by 4 matrices just put numbers between those on the diagonal. To get a non-diagonal matrix (so it looks like you've done more work!) take $A^{-1}DA$ of your diagonal matrix D by some invertible matrix A.

3. Thanks for the reply .. but condition number of D does not seem to be equal to condition number of . I took invertible matrix:
A= [1 1; -1 2] and performed with D=.but i get the condition number as 1.5328 instead of 1.500. I cant make out why??
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 5, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9200536012649536, "perplexity_flag": "head"}