# Birefringence

Birefringence occurs when there is a varying dielectric constant due to an inherent crystal structure in a material. By default it is assumed that materials are amorphous and do not have any particular symmetry groups. But if one is to use a crystal within the program here are the following symmetry groups for permittivity. As a quick reminder, here is the relationship between permittivity and refractive index. Typically μ is close to 1 at optical frequencies.

$$
n = \sqrt{\epsilon\_r \mu\_r}
$$

### Supported Crystal Structures:

**Triclinic** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & b & c\\
b & d & e\\
c & e & f
\end{bmatrix}
$$

**Monoclinic** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & b\\
0 & c & 0\\
d & 0 & e
\end{bmatrix}
$$

**Orthorhombic** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & 0\\
0 & b & 0\\
0 & 0 & c
\end{bmatrix}
$$

**Tetragonal** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & 0\\
0 & b & 0\\
0 & 0 & b
\end{bmatrix}
$$

**Trigonal** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & 0\\
0 & a & 0\\
0 & 0 & b
\end{bmatrix}
$$

**Hexagonal** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & 0\\
0 & a & 0\\
0 & 0 & b
\end{bmatrix}
$$

**Cubic** Crystals have the following form:

$$
\epsilon = \begin{bmatrix}
a & 0 & 0\\
0 & a & 0\\
0 & 0 & a
\end{bmatrix}
$$

### Crystal Axis rotations

Additionally any crystal axis can be rotated relative to the part's mechanical axis, which is the default crystal axis. We can do this by applying a rotation matrix to our permittivity. Where we define our rotation matrix similarly to how we define it for geometric rotations. (ZYX rotation order)

$$
\epsilon'  = \begin{bmatrix}
a\_{xx} & a\_{xy} & a\_{xz}\\
a\_{yx} & a\_{yy} & a\_{yz}\\
a\_{zx} & a\_{zy} & a\_{zz}
\end{bmatrix} \epsilon \ \quad \\
\begin{bmatrix}
a\_{xx} & a\_{xy} & a\_{xz}\\
a\_{yx} & a\_{yy} & a\_{yz}\\
a\_{zx} & a\_{zy} & a\_{zz}
\end{bmatrix}  = \begin{bmatrix}
\cos\theta\cos\phi & \cos\theta\sin\phi\sin\psi-\sin\theta\sin\phi & \cos\theta\sin\phi\cos\psi+\sin\theta\sin\psi\\
\sin\theta\cos\phi& \sin\theta\sin\phi\sin\psi+\cos\theta\cos\psi& \sin\theta\sin\phi\cos\psi-\cos\theta\sin\psi\\
-\sin\phi & \cos\phi\sin\psi & \cos\phi\cos\psi
\end{bmatrix}
$$

### Isotropic Media

For Isotropic media the usual approach is taken using P matrices and calculating the roots of the determinant for the refraction and reflection equation as we can see below. Then from there the Eigenvalues and vectors are found for calculating the change in the Polarization. Where the negative sign on the sqrt is the reflected vector and the positive is for the refracted.

$$
0=\left\lfloor\epsilon+ n\_2^2 \begin{bmatrix}
0& -\hat{k}\_z' & \hat{k}\_y'\\
\hat{k}\_z' &0& -\hat{k}\_x'\\
-\hat{k}\_y' & \hat{k}\_x' & 0
\end{bmatrix}^2 \right\rfloor,\quad \vec{k}' = n\_1 \hat{k} \left\[\pm\sqrt{n\_2^2-n\_1^2+n\_1^2\hat{k}\cdot \hat{N} } - n\_1 \hat{k}\cdot\hat{N} \right] \hat{N}
$$

### Non-Isotropic Media

Calculating the response in a non-isotropic medium can be tricky, but if the medium is smoothly varying (C1 continuous), then we can calculate ray trajectories using similar technique as what is done for the [GRIN solver](/kostacloud/advanced-optics-ray-trace/gradient-index-optics-grin.md). But instead we have to be a little bit more careful in calculating this trajectory. Instead of 1 trajectory we will have 2. Because we do not have any discrete boundaries, we should be able to calculate how these two rays refract the standard GRIN tracing way, given that we keep the solutions straight. Essentially we find the inverse of the determinant to calculate what n2 is and calculate its derivative and perform GRIN calculations the usual way.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kostacloud.com/kostacloud/advanced-optics-ray-trace/birefringence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
