<!--
{
  "documentType" : "article",
  "framework" : "GLKit",
  "identifier" : "/documentation/GLKit/glkmatrix3-pcl",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "GLKMatrix3"
}
-->

# GLKMatrix3

## Overview

The `GLKMatrix3` type defines a `3x3` floating-point matrix as well as many mathematical operations commonly used to manipulate matrices. A `3x3` matrix is commonly used in graphics programming to represent scaling or rotation transformations to convert from one coordinate system to another.

The functions that manipulate `GLKMatrix3` structures treat the inputs as immutable, instead returning a new matrix that represent the results of the operation.

## Topics

### Creating Matrices

[`func GLKMatrix3Make(Float, Float, Float, Float, Float, Float, Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Make(_:_:_:_:_:_:_:_:_:))

Returns a `3x3` matrix created from individual component values.

[`func GLKMatrix3MakeAndTranspose(Float, Float, Float, Float, Float, Float, Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeAndTranspose(_:_:_:_:_:_:_:_:_:))

Returns a `3x3` transposed matrix created from individual component values.

[`func GLKMatrix3MakeWithArray(UnsafeMutablePointer<Float>!) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeWithArray(_:))

Returns a `3x3` matrix created from an array of component values.

[`func GLKMatrix3MakeWithArrayAndTranspose(UnsafeMutablePointer<Float>!) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeWithArrayAndTranspose(_:))

Returns a `3x3` transposed matrix created from an array of component values.

[`func GLKMatrix3MakeWithColumns(GLKVector3, GLKVector3, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeWithColumns(_:_:_:))

Returns a `3x3` matrix created from three column vectors.

[`func GLKMatrix3MakeWithRows(GLKVector3, GLKVector3, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeWithRows(_:_:_:))

Returns a `3x3` matrix created from three row vectors.

[`func GLKMatrix3MakeRotation(Float, Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeRotation(_:_:_:_:))

Returns a `3x3` matrix that performs a rotation around an arbitrary vector.

[`func GLKMatrix3MakeXRotation(Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeXRotation(_:))

Returns a `3x3` matrix that performs a rotation around the positive x-axis.

[`func GLKMatrix3MakeYRotation(Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeYRotation(_:))

Returns a `3x3` matrix that performs a rotation around the positive y-axis.

[`func GLKMatrix3MakeZRotation(Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeZRotation(_:))

Returns a `3x3` matrix that performs a rotation around the positive z-axis.

[`func GLKMatrix3MakeWithQuaternion(GLKQuaternion) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeWithQuaternion(_:))

Returns a `3x3` matrix that performs a rotation based on a quaternion.

[`func GLKMatrix3MakeScale(Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3MakeScale(_:_:_:))

Returns a `3x3` matrix that performs a scaling transformation.

### Working With Parts of a Matrix

[`func GLKMatrix3GetMatrix2(GLKMatrix3) -> GLKMatrix2`](/documentation/GLKit/GLKMatrix3GetMatrix2(_:))

Returns the upper-left `2x2` section of a `3x3` matrix.

[`func GLKMatrix3GetColumn(GLKMatrix3, Int32) -> GLKVector3`](/documentation/GLKit/GLKMatrix3GetColumn(_:_:))

Retrieves a column from a `3x3` matrix.

[`func GLKMatrix3GetRow(GLKMatrix3, Int32) -> GLKVector3`](/documentation/GLKit/GLKMatrix3GetRow(_:_:))

Retrieves a row from a `3x3` matrix.

[`func GLKMatrix3SetColumn(GLKMatrix3, Int32, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3SetColumn(_:_:_:))

Returns a new `3x3` matrix with one column replaced by a new vector.

[`func GLKMatrix3SetRow(GLKMatrix3, Int32, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3SetRow(_:_:_:))

Returns a new `3x3` matrix with one row replaced by a new vector.

### Performing Mathematical Operations on Matrices

[`func GLKMatrix3Invert(GLKMatrix3, UnsafeMutablePointer<Bool>!) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Invert(_:_:))

Returns the inverse of a matrix.

[`func GLKMatrix3Transpose(GLKMatrix3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Transpose(_:))

Returns the transpose of a matrix.

[`func GLKMatrix3InvertAndTranspose(GLKMatrix3, UnsafeMutablePointer<Bool>!) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3InvertAndTranspose(_:_:))

Returns the inverse transpose of a matrix.

[`func GLKMatrix3Multiply(GLKMatrix3, GLKMatrix3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Multiply(_:_:))

Returns the product of two matrices.

[`func GLKMatrix3Rotate(GLKMatrix3, Float, Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Rotate(_:_:_:_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around a vector.

[`func GLKMatrix3RotateWithVector3(GLKMatrix3, Float, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3RotateWithVector3(_:_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around a vector.

[`func GLKMatrix3RotateWithVector4(GLKMatrix3, Float, GLKVector4) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3RotateWithVector4(_:_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around a vector.

[`func GLKMatrix3RotateX(GLKMatrix3, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3RotateX(_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around the x-axis.

[`func GLKMatrix3RotateY(GLKMatrix3, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3RotateY(_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around the y-axis.

[`func GLKMatrix3RotateZ(GLKMatrix3, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3RotateZ(_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a rotation around the z-axis.

[`func GLKMatrix3Scale(GLKMatrix3, Float, Float, Float) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Scale(_:_:_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a scaling transform.

[`func GLKMatrix3ScaleWithVector3(GLKMatrix3, GLKVector3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3ScaleWithVector3(_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a scaling transform defined by a vector.

[`func GLKMatrix3ScaleWithVector4(GLKMatrix3, GLKVector4) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3ScaleWithVector4(_:_:))

Returns a new `3x3` matrix created by concatenating a matrix with a scaling transform defined by a vector.

[`func GLKMatrix3Add(GLKMatrix3, GLKMatrix3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Add(_:_:))

Returns a new `3x3` matrix created by performing a component-wise addition of two matrices.

[`func GLKMatrix3Subtract(GLKMatrix3, GLKMatrix3) -> GLKMatrix3`](/documentation/GLKit/GLKMatrix3Subtract(_:_:))

Returns a new `3x3` matrix created by performing a component-wise subtraction of two matrices.

### Performing Mathematical Operations on Vectors

[`func GLKMatrix3MultiplyVector3(GLKMatrix3, GLKVector3) -> GLKVector3`](/documentation/GLKit/GLKMatrix3MultiplyVector3(_:_:))

Multiplies a `3x3` matrix by a vector.

[`func GLKMatrix3MultiplyVector3Array(GLKMatrix3, UnsafeMutablePointer<GLKVector3>, Int)`](/documentation/GLKit/GLKMatrix3MultiplyVector3Array(_:_:_:))

Multiplies a `3x3` matrix by an array of vectors.

### Data Types

[`typealias GLKMatrix2`](/documentation/GLKit/GLKMatrix2)

A `2x2` matrix.

[`typealias GLKMatrix3`](/documentation/GLKit/GLKMatrix3)

A `3x3` matrix stored in column-major order.

### Constants

[`let GLKMatrix3Identity: GLKMatrix3`](/documentation/GLKit/GLKMatrix3Identity)

A `3x3` identity matrix.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)