# Generate matrices that satisfy multiple conditions

**URL:** <https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315>\
**Category:** General Usage\
**Created:** [April 19, 2019, 5:16pm UTC](https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315 "2019-04-19T17:16:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 20, 2019, 5:37am UTC](https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315/2 "2019-04-20T05:37:02Z")

</div>

This is very similar in spirit to your [other question](https://discourse.julialang.org/t/verify-a-matrix-is-positive-semi-definite/23329/4), trying to numerically “verify” something that you can show using math.

This is a very unusual application, and it is not possible to help you more without some context.

Specifically, is this a homework problem?

As you noted, if you randomly generate an orthonormal matrix, it has a 0 (theoretically, maybe near-`0` numerically) chance of being triangular. Your approach is conceptually similar to

```julia
while true
    r = randn()
    if iszero(r)
        @info r^2 == r # verify that 0*0 == 0 numerically
    end
end

```

---

_[View the full topic](https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315)._
