# Symbolics Writing element (matrix) inverse

**URL:** https://discourse.julialang.org/t/symbolics-writing-element-matrix-inverse/105191
**Category:** General Usage
**Created:** [October 19, 2023, 3:40pm UTC](https://discourse.julialang.org/t/symbolics-writing-element-matrix-inverse/105191 "2023-10-19T15:40:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fimiller](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fimiller/32/51226_2.png) [@fimiller](https://discourse.julialang.org/u/fimiller)
#### Post date: [October 19, 2023, 3:40pm UTC](https://discourse.julialang.org/t/symbolics-writing-element-matrix-inverse/105191/1 "2023-10-19T15:40:31Z")

</div>

Hello,

I am trying to create a symbolic representation of some algebra that I am trying to work out for a project. Ideally, I would like to create a way to write an expression like below:

```julia
@variables H, \sigma # H is an nxn matrix, \sigma is a number
A = [H 0; 0 \sigma] # where H is "like" a block matrix 

```

Then, `inv(A)` becomes `[1/H 0; 0 1 / \sigma]`  
Instead of `1/H`, I want this to read as `H^{-1}`. Is this possible to do symbolically?

Alternatively, is there a way to have a `@variables` where the variable we create is not necessarily considered a `Num`, but instead a matrix of size `n x n`, but I do not need to specify the exact size of `n`? I think this would then allow the behavior I am hoping for above.

Thank you!
