<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet href="/~yosh/style/blog.xsl" type="text/xsl" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self" type="application/atom+xml" href="https://www.unix.dog/~yosh/blog/feed.atom" />
<link rel="alternate" type="text/html" href="https://www.unix.dog/~yosh/blog" />
<title>yosh's blog</title>
<author><name>yosh</name></author>
<updated>2026-04-30T17:30:00Z</updated>
<id>urn:uuid:ab54972a-c095-4177-8a36-b77d48d86bec</id><entry>
			<title>JPEG XL for imhex (+ pattern language thoughts)</title>
			<link rel="alternate" href="/~yosh/blog/jxl-imhex-and-the-pattern-lang.html" />
			<id>urn:uuid:ddd26656-12bb-4cf3-9feb-777f9365d416</id>
			<published>2026-04-30T17:30:00Z</published>
			<updated>2026-04-30T17:30:00Z</updated>
			<content type="html">
&lt;p&gt;&lt;a href=&quot;https://jpeg.org/jpegxl/&quot;&gt;JPEG XL&lt;/a&gt; is the final image format. Or, one of the final formats, that is. It’s not going to subsume raw camera formats or certain specific interchange formats, but that’s alright; it’s enough to encompass most images most computer touchers encounter. I’ve been following the format for at least &lt;a href=&quot;https://github.com/void-linux/void-packages/pull/44599&quot;&gt;a few years&lt;/a&gt;, and it’s been quite exciting to see &lt;a href=&quot;https://en.wikipedia.org/wiki/JPEG_XL#Official_software_support&quot;&gt;its gradual adoption among desktop software&lt;/a&gt;. Between screenshots, photos, and archival scans, it’s the dominant form of images on my computer, and one day I hope this is the same for the web.&lt;/p&gt;
&lt;p&gt;In tandem, I’ve been trying to focus more on &lt;em&gt;doing&lt;/em&gt; things; it helps manage the tedium of life when I contribute to projects or pursue knowledge on my own. Kind of “de-consumptioning” myself a bit—motioning away from the sludge of it all. This leads to me occasionally perusing the things I use to see if there’s anything I can help out with, filing issues or maybe a PR should motivation be tickled enough.&lt;/p&gt;
&lt;p&gt;So, I talk to &lt;a href=&quot;https://github.com/jonnyawsom3&quot;&gt;jonny&lt;/a&gt; about JXL a bunch. He relays updates on the standard &amp;amp; libjxl from the developers, and we have a good time ruminating its progression. Typical nerd stuff. Around two weeks ago (as of writing), I was looking around the libjxl repo and found &lt;a href=&quot;https://github.com/libjxl/libjxl/issues/4653&quot;&gt;this bug&lt;/a&gt; that he filed—seemingly an error when a specific flag is switched. Recreating the bug &amp;amp; putting the files in the &lt;a href=&quot;https://imhex.werwolv.net/&quot;&gt;imhex&lt;/a&gt; hex editor to diff them led to an interesting observation: only one bit in the first several bytes changes between the broken image and the correct image.&lt;/p&gt;
&lt;p&gt;Interest was piqued, as combining this with the hint someone else commented pointed towards some bug in header encoding or decoding. Searching ‘round the block to see if anyone had made a JXL pattern for imhex turned up with &lt;a href=&quot;https://github.com/WerWolv/ImHex-Patterns/pull/388&quot;&gt;this pull request&lt;/a&gt; on the patterns repo. A noble effort for sure, but a couple things with it didn’t work for my case:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
It only matches against &lt;a href=&quot;https://www.iso.org/standard/91379.html&quot;&gt;the box file format&lt;/a&gt; standard.
&lt;ul&gt;
&lt;li&gt;
A “bare” codestream is an equally valid JXL file, so this pattern would fail on those kinds of images.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Corollary: it doesn’t do any fine-grained codestream decoding, which is what the entire bug is about.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I ~could~ have trawled through the libjxl source code with the stacktrace from someone else, but alas, the JXL standard is quite lengthy, and the source code of libjxl is quite sprawled&lt;a id=&quot;fnref1&quot; href=&quot;#fn1&quot; role=&quot;doc-noteref&quot;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;. It’d be folly to run through the bits myself or print at every stage of decoding every time a header bug pops up.&lt;/p&gt;
&lt;p&gt;Given it all, I thought it’d be much faster, more useful to everyone, and kind of just a fun idea to make my own pattern for JXL. I’ve never made an imhex pattern before (or for that matter, I’ve barely used imhex at all before), so it’d be a simultaneous journey of learning imhex’s DSL and internalizing the JXL standard.&lt;/p&gt;
&lt;section id=&quot;the-file&quot;&gt;
&lt;h2&gt;the file!&lt;/h2&gt;
&lt;p&gt;Cutting to the chase: You can get the pattern at &lt;a href=&quot;https://git.unix.dog/yosh/yosh-imhex-patterns&quot;&gt;my imhex patterns repo&lt;/a&gt;. While I would have wished that I could parse every bit of the format, the entropy coding parts&lt;a id=&quot;fnref2&quot; href=&quot;#fn2&quot; role=&quot;doc-noteref&quot;&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; are just a bit too complex to realistically implement in imhex’s not-that-much-of-a-programming language. As such, there’s a few deficiencies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Codestreams that have an embedded ICC pattern or a permuted TOC will return early with a warning.
&lt;/li&gt;
&lt;li&gt;
No fine-grained parsing is done of the actual frame groups—they’re just generic byte spans.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Despite those unimplemented paths, it seems to be one of the most complex imhex patterns that exist:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ wc -l jxl.hexpat
1073 jxl.hexpat
$ wc -l /usr/share/imhex/patterns/* | sort -nr | head
   5594 /usr/share/imhex/patterns/dicom.hexpat
   1312 /usr/share/imhex/patterns/pe.hexpat
   1140 /usr/share/imhex/patterns/3ds.hexpat
   1121 /usr/share/imhex/patterns/java_class.hexpat
    934 /usr/share/imhex/patterns/stdfv4.hexpat
    921 /usr/share/imhex/patterns/dotnet_binaryformatter.hexpat
    835 /usr/share/imhex/patterns/elf.hexpat
    833 /usr/share/imhex/patterns/max_v104.hexpat
    726 /usr/share/imhex/patterns/selinux.hexpat
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Subtract about 150 lines from mine due to comments. They’re quite dense lines as well! Most of the lines for the other high rankers are taken up by huge lookup tables or pattern matches, while JXL just has a ton of conditional branching, bitfields, &amp;amp; types inherent to it.&lt;/p&gt;
&lt;p&gt;It’s quite snazzy to see it in action:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;a screenshot of imhex, showing a nearly-expanded pattern data window that has a wealth of information about the codestream for the jxl image&quot; src=&quot;jxl-imhex-screenshot.png&quot;/&gt;&lt;/p&gt;
&lt;p&gt;And yes, in the end, &lt;a href=&quot;https://github.com/libjxl/libjxl/pull/4728&quot;&gt;I did end up fixing the bug&lt;/a&gt; with the help of this pattern. It was quite easy to see what caused it when I could quickly visualize that it happens on a byte boundary!&lt;/p&gt;
&lt;section id=&quot;sidenote-jxl-is-crazier-than-I-thought&quot;&gt;
&lt;h3&gt;sidenote: jxl is crazier than I thought&lt;/h3&gt;
&lt;p&gt;I knew that JXL was The Future Image Format for a while now, but actually delving into the standard has made me realize just how much is done for the various use cases it wants to exist in.&lt;/p&gt;
&lt;p&gt;For example, the codestream performs extensive bit packing techniques to squeeze out mere bytes. Is it storing width and height as 4 bytes each? nah, use 1 bit to determine if it’s a “small” image or not, and if it is, it read 5 bits for the height, then the real height is that multiplied by 8. Then read 3 bits to determine the “ratio”, which is a lookup table of common ratios. If it’s not any of those common ratios, then the width is encoded separately. Otherwise, no more bits are needed.&lt;a id=&quot;fnref3&quot; href=&quot;#fn3&quot; role=&quot;doc-noteref&quot;&gt;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt; The separate encoding isn’t just 4 bytes or whatever either; it uses two bits to multiplex four different other integer widths so that smaller images just use less space overall.&lt;a id=&quot;fnref4&quot; href=&quot;#fn4&quot; role=&quot;doc-noteref&quot;&gt;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In isolation, these things only shave off like, what, a couple tens of bytes? if you consider the entirety of the codestream’s complexity. But if you’re dealing with hundreds of thousands of low-resolution, standardized images (like, say, for thumbnailing or previewing), those bytes saved add up real fast.&lt;/p&gt;
&lt;p&gt;That’s the kind of stuff the codestream does. It’s quite neat.&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id=&quot;the-pattern-language&quot;&gt;
&lt;h2&gt;the pattern language…&lt;/h2&gt;
&lt;p&gt;Since this was my first imhex pattern, I made sure to scour the entire documentation and all the different avenues I could approach writing it from. While writing, I mentally noted aspects of the language that poked some thorns in my side. First off, things that jumped out at me:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
I do not enjoy that variables are syntactically scoped like a conventional language. I &lt;a href=&quot;https://git.unix.dog/yosh/yosh-imhex-patterns/src/commit/4900a70bcf7b6895c6a0ad8cc6575dff1ae345f2/jxl.hexpat#L758&quot;&gt;have to use global variables&lt;/a&gt; to simultaneously track state and assign “default” values to fields, since variables in, say, an &lt;code&gt;if&lt;/code&gt; block are scoped to said &lt;code&gt;if&lt;/code&gt; block.
&lt;ul&gt;
&lt;li&gt;
I think the greatest “simple” thing that would make the language much better is if variables in a pattern were scoped to the pattern itself. This alone would eliminate most of the global variable duplication in the JXL pattern.
&lt;/li&gt;
&lt;li&gt;
In addition, being able to assign “default” values to memory-backed variables that would serve as its value in case it never gets matched in the file.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
For some reason, &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/data-types#templates&quot;&gt;template types&lt;/a&gt; don’t work on bitfields. However, &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/data-types#non-type-template-parameters&quot;&gt;&lt;em&gt;non-type template parameters&lt;/em&gt;&lt;/a&gt; do? Very confusing.
&lt;ul&gt;
&lt;li&gt;
This means I had to create &lt;a href=&quot;https://git.unix.dog/yosh/yosh-imhex-patterns/src/commit/4900a70bcf7b6895c6a0ad8cc6575dff1ae345f2/jxl.hexpat#L52&quot;&gt;five separate types&lt;/a&gt; for JXL’s &lt;code&gt;U32&lt;/code&gt; parameterizations, since they’re bit-level types.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
I don’t understand why untagged unions exist when conditional parsing is a thing. &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/data-types#unions&quot;&gt;the documentation&lt;/a&gt; only gives the use case of inspecting data as multiple types, but that could also be accomplished by a change to the pattern data viewer—some kind of format casting built in or something.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In an overall sense, the language feels like if C++ was kludged into a binary file pattern matcher, with a &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/data-types#unsigned-integers&quot;&gt;few&lt;/a&gt; &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/functions&quot;&gt;minor&lt;/a&gt; &lt;a href=&quot;https://docs.werwolv.net/pattern-language/core-language/control-flow#match-statements&quot;&gt;rust-isms&lt;/a&gt; taken up along the way, rather than built from the ground up as its own DSL for its own domain.&lt;/p&gt;
&lt;p&gt;So, it got me thinking about the language, and my mind wandered off many times along the way. A few scattered ideas came out of it all—some loose thoughts on how I’d want a pattern language to operate and feel like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
No treating bytes as something absolutely fundamental to the pattern language; bits and bytes should exist in harmony rather than separated by different types.
&lt;ul&gt;
&lt;li&gt;
As a result, there’s only one type for “collections” of things, and you can control whether it’s padded by default or bit-packed by default, with a quick way to make exceptions for individual fields.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Patterns are declarative rather than mimicing how an imperative language would go through something. This would alleviate cognitive disconnect when combined with pattern-scoped variables.
&lt;ul&gt;
&lt;li&gt;
Combine this with “flattening” the syntax to further hound the idea that only pattern-level scopes matter. Say, instead of &lt;code&gt;if (parse_x) { x : u8 }&lt;/code&gt;, it’s &lt;code&gt;x : u8 if parse_x&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Variables are immutable; patterns can’t affect the file. A variable’s value is determined only by its memory or, if its condition for existing isn’t met, some other method of assigning a default value (adding on to the if? &lt;code&gt;x : u8 if parse_x else 0&lt;/code&gt;? Propagating sum types of non-existent variables?).
&lt;/li&gt;
&lt;li&gt;
It would be cool if there was some kind of external plugin system that allowed more complex tasks to be done in a less domain-specific language (like, say, entropy decoding).
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The overarching idea is just that matching patterns against a file would fit better as a more declarative (“functional”?) paradigm than how imhex operates. Alas, a complete, exact syntax escapes me, since I haven’t thought about it too much. I didn’t find much more enjoyment on thinking about what could be something when implementing it would be quite a large undertaking for little benefit (I don’t reverse engineer formats often enough, and imhex is already quite dominant, so would anyone even use a different pattern language?). But it’s nice to passively think about.&lt;/p&gt;
&lt;p&gt;So many ideas, so little time.&lt;/p&gt;
&lt;/section&gt;
&lt;section role=&quot;doc-endnotes&quot;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&quot;fn1&quot;&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/jonsneyers&quot;&gt;Jon Sneyers&lt;/a&gt; said on the JXL Discord about it: “libjxl has never been a particularly elegant or clean codebase, it was born by smashing together the &lt;a href=&quot;https://github.com/google/pik&quot;&gt;pik&lt;/a&gt; and &lt;a href=&quot;https://github.com/cloudinary/fuif&quot;&gt;fuif&lt;/a&gt; code and then doing lots of experimental stuff on top of that. I think it was a bit too ambitious to try to be at the same time a reference implementation, cutting edge in terms of both speed and compression performance, and production ready. I mean, I think it kind of achieves all of that, but not in a way that is easy to maintain or contribute improvements to.” &lt;a href=&quot;#fnref1&quot; role=&quot;doc-backlink&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&quot;fn2&quot;&gt;
&lt;p&gt;Annex C of &lt;a href=&quot;https://www.iso.org/standard/85066.html&quot;&gt;ISO/IEC 18181-1:2024&lt;/a&gt; &lt;a href=&quot;#fnref2&quot; role=&quot;doc-backlink&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&quot;fn3&quot;&gt;
&lt;p&gt;Section D.2 of ISO/IEC 18181-1:2024 &lt;a href=&quot;#fnref3&quot; role=&quot;doc-backlink&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&quot;fn4&quot;&gt;
&lt;p&gt;Section B.2.2 of ISO/IEC 18181-1:2024 &lt;a href=&quot;#fnref4&quot; role=&quot;doc-backlink&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>some C habits I employ for the modern day</title>
			<link rel="alternate" href="/~yosh/blog/c-habits-for-me.html" />
			<id>urn:uuid:02d56a1e-4d10-4ea7-a205-9e9ccc1a3d50</id>
			<published>2026-01-17T21:02:00Z</published>
			<updated>2026-03-02T21:20:00Z</updated>
			<content type="html">
&lt;p&gt;Despite it being the first “proper” programming language I learned—by reading K&amp;amp;R front-to-back no less—I don’t write C too terribly often nowadays. Playing &lt;a href=&quot;https://resonite.com&quot;&gt;resonite&lt;/a&gt; has gotten me into writing a load of C# for modding the game, and most of what I do day-to-day is automating the tedium on my computer, which gets delegated to shell or python because of all the existing infrastructure.&lt;/p&gt;
&lt;p&gt;Alas, every now and then, something arises where I have to or just want to write some C (or C++). Sometimes it’s when &lt;a href=&quot;https://git.unix.dog/yosh/bc7enc_rdo_ffi/src/branch/master/ffi.cpp&quot;&gt;I need to make some bindings for a library&lt;/a&gt;; sometimes it’s &lt;a href=&quot;https://git.unix.dog/yosh/blsm&quot;&gt;to fill a niche of a language/architecture gap&lt;/a&gt;. It also remains as my favorite language to prototype stuff in, though I’m not quite sure why.&lt;/p&gt;
&lt;p&gt;In any case, C is an interesting language without much standardization on the whole “style” or “practices” part. Most other languages have very clear “this is the best way to use X” messages, either subtly embedded in the syntax itself or through “official” documentation channels. C doesn’t have an official documentation channel, nor does it have syntax or standard library constructs that encourage one particular way of doing things. From this, there’s a bunch of inconsistencies in how people do things, and—especially in the early days of the language and standard library—the landscape and general practice is quite error prone. As such, I’ve developed my own habits when writing C, usually picked up from blog posts, writing C# or rust, or just out of perfectionist brain.&lt;/p&gt;
&lt;p&gt;I’m not saying you should write stuff this way, nor am I claiming it is the best way to write C all the time. I break some of these practices when working with embedded systems or when I’m writing things to be as fast as they can possibly be. But it is the baseline I tend to start with for most projects, and if I don’t write it down, I’ll never be consistent with it.&lt;/p&gt;
&lt;section id=&quot;the-basics&quot;&gt;
&lt;h2&gt;the basics&lt;/h2&gt;
&lt;p&gt;I usually use C23 for my new C projects. When contributing to other projects, I of course use their revision, but C23 enables a fair amount of the things possible in this post, so it’s what I stick with for projects that aren’t trying to target absolute maximum portability or embedded architectures (i.e. I’d only care about GCC, clang, and &lt;em&gt;maybe&lt;/em&gt; MSVC). almost every platform, including any POSIX-compliant one, &lt;a href=&quot;https://en.wikipedia.org/wiki/C_data_types#Main_types&quot;&gt;has &lt;code&gt;CHAR_BIT&lt;/code&gt; set to &lt;code&gt;8&lt;/code&gt;&lt;/a&gt;, so I like to make it explicitly clear that this is what the project is for by putting this in there:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#if CHAR_BIT != 8
	#error &quot;CHAR_BIT != 8&quot;
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Something very small that I liked a &lt;em&gt;lot&lt;/em&gt; when learning rust was its short way of referring to fixed-length types. Combine that with &lt;a href=&quot;https://nullprogram.com/blog/2023/10/08/&quot;&gt;chris wellon’s other typedefs&lt;/a&gt; and I end up having all these &lt;code&gt;typedef&lt;/code&gt;s in my projects:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef uint8_t   u8;
typedef int8_t    i8;
typedef int16_t   i16;
typedef uint16_t  u16;
typedef int32_t   i32;
typedef uint32_t  u32;
typedef uint64_t  u64;
typedef float     f32;
typedef double    f64;
typedef uintptr_t uptr;
typedef ptrdiff_t isize;
typedef size_t    usize;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may notice that the &lt;code&gt;byte&lt;/code&gt; and &lt;code&gt;b32&lt;/code&gt; from wellon’s post are missing here. As said before, when employing this style, I don’t care for systems where char isn’t 8 bit, so the distinction between &lt;code&gt;u8&lt;/code&gt; and &lt;code&gt;char&lt;/code&gt; doesn’t mean anything to me here. Additionally, the intent of whether the buffer is used as “raw” memory chunks versus a meaningful &lt;code&gt;u8&lt;/code&gt; is pretty clear from the code that it gets used in, so I’m not worried about confusing intent with it.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;b32&lt;/code&gt; is missing because I just use the C23 &lt;code&gt;bool&lt;/code&gt; type. If I’m working with &amp;gt;=C99, I use &lt;code&gt;stdbool.h&lt;/code&gt; and &lt;code&gt;bool&lt;/code&gt;. Its semantics are familiar to me already, and it just feels more right to use for, well, booleans.&lt;/p&gt;
&lt;p&gt;I’ve long been employing the length+data string struct. If there was one thing I could go back and time to change about the C language, it would be removal of the null-terminated string. Alas, we do not live in the perfect world, so I work with this for now:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef struct {
	// includes null terminator (for bad functions)
	u8 *data;
	// excludes null terminator (for copying memory)
	isize len;
} String;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Along with some functions to initialize from an existing cstr or buffer, copy the string safely, etc.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;parsing-not-validating&quot;&gt;
&lt;h2&gt;parsing, not validating&lt;/h2&gt;
&lt;p&gt;I think one of the most eye-opening blog posts I read when getting into programming initially was the evergreen &lt;a href=&quot;https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/&quot;&gt;parse, don’t validate&lt;/a&gt; post. If you haven’t read it yourself, I highly encourage you to do so. The TL;DR of it is to work with your language’s type system to the fullest extent, making function signatures take very strict types that can only really be created through trusted interfaces that you provide. In doing so, you get to have an incredibly robust API with very clear, usually compile-time indications when something goes wrong.&lt;/p&gt;
&lt;p&gt;I was thinking about how to apply this sort of philosophy to C for a bit—I knew that the most flexible and strong part of C’s comparatively weak type system is the humble &lt;code&gt;struct&lt;/code&gt;—but I didn’t know how to go about the whole “can only really be created through trusted interfaces” bit and promptly put it out of my mind when working with C. A few years later, I saw someone link it again on the web, and curiously looked up to see if anyone else tried applying it to C. This took me to &lt;a href=&quot;https://www.lelanthran.com/chap13/content.html&quot;&gt;lelanthran’s blog post&lt;/a&gt; that talks about it, where I learned that you &lt;em&gt;can&lt;/em&gt; in fact &lt;a href=&quot;https://www.lelanthran.com/chap9/content.html&quot;&gt;create arbitrary opaque types&lt;/a&gt; and thus properly employ this style.&lt;/p&gt;
&lt;p&gt;I was going to embed an in-progress rewrite I’m doing of &lt;a href=&quot;https://git.unix.dog/yosh/blsm&quot;&gt;blsm&lt;/a&gt; that employs this principle, but I accidentally overwrote most of the code via a mishap with syncthing. Oops. So, you’ll just have to trust me when I say that I actually do this nowadays for non-playground projects :)&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;tuples&quot;&gt;
&lt;h2&gt;tuples!&lt;/h2&gt;
&lt;p&gt;One of the more exciting changes of C23 is the explicit standardization that tagged types (&lt;code&gt;struct&lt;/code&gt;, &lt;code&gt;union&lt;/code&gt;, &lt;code&gt;enum&lt;/code&gt;) with the same name and contents &lt;a href=&quot;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3037.pdf&quot;&gt;are completely compatible with one another&lt;/a&gt;. Oftentimes, I wish to return multiple values from a function, but feel as if there’s not much semantic need to assign explicit names to the structure or the members within. Enter the humble tuple:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define Tuple2(T1, T2)           \
	struct Tuple2_##T1##_##T2 {  \
		T1 a;                    \
		T2 b;                    \
	}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Others may use different names for the members—I’ve seen &lt;code&gt;_0&lt;/code&gt;, &lt;code&gt;_1&lt;/code&gt;, etc. To roughly mirror rust’s semantics, but I find that a little awkward. The english alphabet is more than familiar to me, so it’s what I’ve stuck to.&lt;/p&gt;
&lt;p&gt;Unfortunately, as one might have noticed, this cool feature gets severely limited by the fact that this does &lt;em&gt;not&lt;/em&gt; apply to &lt;em&gt;anonymous&lt;/em&gt; tagged types (I’d personally consider “untagged” tagged types with the same content to be compatible, but I guess WG13 disagrees). As such, every instance of this feature requires an actual name to be bound to the type. This means that pointers will throw a wrench into it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cc kmp.c
In file included from kmp.c:5:
kmp.c: In function \'apos;main\'apos;:
kmp.c:29:20: error: pasting &quot;*&quot; and &quot;_&quot; does not give a valid preprocessing token
   29 |         Tuple2(char*, int) buffer;
      |                    ^
../common/tuple.h:5:25: note: in definition of macro \'apos;Tuple2\'apos;
    5 |         struct Tuple2_##T1##_##T2 {  \
      |                         ^~
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This can be worked around by either making a &lt;code&gt;typedef&lt;/code&gt; for the pointer or by &lt;a href=&quot;https://old.reddit.com/r/C_Programming/comments/1cmqqgw/c23_makes_errors_awesome/l34lutg/?context=3#l34lutg&quot;&gt;having the user provide an explicit name for the struct&lt;/a&gt;. Neither are exactly the most ergonomic, so I don’t find myself using this feature as much as I wish.&lt;/p&gt;
&lt;p&gt;In any case, for tuples specifically, I’m usually not storing a pointer in them. When it gets to that point, I probably want an actual struct with semantic meaning instead.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;returning-results&quot;&gt;
&lt;h2&gt;returning results&lt;/h2&gt;
&lt;p&gt;With the idea of trying to encode as much as possible in the type system itself, I’m a pretty big fan of &lt;a href=&quot;https://en.wikipedia.org/wiki/Tagged_union&quot;&gt;sum types&lt;/a&gt; when it makes sense for the language to have them. Naturally, I try to employ using them in C.&lt;/p&gt;
&lt;p&gt;In the absence of proper language support, “sum types” are just structs with discipline. These structs will usually be used for public-facing apis and/or have semantic meaning in their own right, so I’m more comfortable making them a typedef as opposed to trying to fuddle in a “result” type into this whole equation. Maybe if C ever allows anonymous tagged types to be compatible will this change, but for now it’s what I have to work with.&lt;/p&gt;
&lt;p&gt;The structures generally follow this pattern:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef enum {
	...
} ErrorCode;

typedef struct {
	char *val;
} SafeBuffer;

typedef struct {
	bool ok;
	union {
		SafeBuffer *val;
		ErrorCode err;
	};
} MaybeBuffer;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Along with functions to handle printing error messages/etc. For the various error codes that can be returned. The idea is for the caller to always check the &lt;code&gt;ok&lt;/code&gt; upon return. You could probably add on a “match” function to specifically handle this without the ability to actually introspect on the struct like before, but that’s incredibly verbose and poor ergonomically in my opinion—this is all compensation for the lack of proper sum types anyway.&lt;/p&gt;
&lt;p&gt;When these result types are combined with the previous “parse, don’t validate” approach, I find that I don’t actually dread handling errors in C. If I encounter a function that I know “parses” something, I know it’s going to return a &lt;code&gt;Maybe&lt;/code&gt; struct and check &lt;code&gt;ok&lt;/code&gt;. If I’m implementing a function that &lt;em&gt;uses&lt;/em&gt; one of those &lt;code&gt;SafeBuffer&lt;/code&gt; types, I know that there are certain invariants that I can assume to be true, since that type could have only been created through the parsing function.&lt;/p&gt;
&lt;p&gt;It sacrifies a bit of verbosity (since C lacks all the nice functional syntax sugar that makes this concise) for much nicer flowing (and safer!) programs&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;on-dynamic-memory-management&quot;&gt;
&lt;h2&gt;on dynamic memory management&lt;/h2&gt;
&lt;p&gt;I don’t personally do things that require dynamic memory management in C often, so I don’t have many practices for it. I know that wellons &amp;amp; co. Have been really liking the arena, and I’d probably like it too if I actually used the heap often. But I don’t, so I have nothing to say.&lt;/p&gt;
&lt;p&gt;If I find myself needing a bunch of dynamic memory allocations and lifetime management, I will simply start using another language—usually rust or C#. But I also don’t find myself programming that kind of stuff often &lt;em&gt;in general&lt;/em&gt;, so it’s really just something I need to explore more as a whole.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;anything-else&quot;&gt;
&lt;h2&gt;anything else?&lt;/h2&gt;
&lt;p&gt;A few smaller things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
I tend to avoid the &lt;code&gt;string.h&lt;/code&gt; functions most of the time, only employing the &lt;code&gt;mem&lt;/code&gt; family when I want to, well, mess with memory.
&lt;/li&gt;
&lt;li&gt;
other than that, I only use the standard library &lt;em&gt;in general&lt;/em&gt; when I need to do OS functions—I find that a lot of the apis are &lt;a href=&quot;https://youtu.be/Sg4U4r_AgJU?t=150&quot;&gt;less than ideal to work with&lt;/a&gt; and usually prefer to just reimplement needed ones.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There isn’t much else that I really feel the need to mention. I check the documentation for any external functions I use—because there’s always a wrench that can hide in &lt;code&gt;man&lt;/code&gt;—and &lt;em&gt;try&lt;/em&gt; to check any nontrivial accesses or funky stuff that might need to be done. Maybe I’ll try to go about making a sort of “slice” type to make that stuff safer, but for now, nothing’s bitten me just yet.&lt;/p&gt;
&lt;p&gt;I hope this can get anyone to try thinking about their own C style. I love this language a lot of times yet hate it many other times. At least the limitations can make for some fun problems to solve and safeguards to create :)&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;going-further-2026-03-02&quot;&gt;
&lt;h2&gt;going further (2026-03-02)&lt;/h2&gt;
&lt;p&gt;I meant to put this in the original post, but I completely forgot. &lt;a href=&quot;https://github.com/hirrolot/metalang99&quot;&gt;Metalang99&lt;/a&gt; is a metaprogramming language implemented in the C preprocessor that allows for a range of interesting things that would be pipe dreams (or horrors) in normal C. Such dreams include &lt;a href=&quot;https://github.com/hirrolot/interface99&quot;&gt;interface types&lt;/a&gt; or &lt;a href=&quot;https://github.com/hirrolot/datatype99&quot;&gt;&lt;em&gt;actual&lt;/em&gt; algebraic data types&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It would be quite interesting to see how this manifests in a real project. Maybe I’ll use it one day.&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>rambling about polar quaternions (and some clifford algebra)</title>
			<link rel="alternate" href="/~yosh/blog/rambling-about-quaternions.html" />
			<id>urn:uuid:9c41ca8d-c728-4fa1-911a-20aac3b8d674</id>
			<published>2025-09-27T22:32:17Z</published>
			<updated>2025-09-27T22:32:17Z</updated>
			<content type="html">
&lt;p&gt;I’ve wanted to make my own “how to actually understand and work with quaternions” thing for a bit now. it’d try to explain things in a way that doesn’t require any visualization, but also doesn’t try going too much into the formalities that tend to come with non-visualizations of quaternions.&lt;/p&gt;
&lt;p&gt;this isn’t that explanation, but rather some miscellaneous rambles in my journey to re-derive all of quaternion stuff from only the definition.&lt;/p&gt;
&lt;p&gt;the core of this kind of explanation relies on &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot;&gt;euler’s formula&lt;/a&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/math&gt;
&lt;p&gt;this is familiar to most who are already content with complex numbers, and easily provable from knowing the taylor expansions of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;, &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/math&gt;, and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/math&gt;. in any case, the key to this is the idea that &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/math&gt; specifically isn’t special here. any “thing” that squares to -1 will work in this formula, and this includes quaternions.&lt;/p&gt;
&lt;section id=&quot;polar-complex-numbers&quot;&gt;
&lt;h2&gt;polar complex numbers&lt;/h2&gt;
&lt;p&gt;to get back to complex numbers, say we have a complex number &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/math&gt;. to express it as an exponential:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;atan&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo rspace=&quot;0&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;
&lt;p&gt;e.g. &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mn&gt;9&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;16&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;atan&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;mo rspace=&quot;0&quot;&gt;,&lt;/mo&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;5&lt;/mn&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mn&gt;0.9273&lt;/mn&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mi&gt;.&lt;/mi&gt;&lt;/math&gt;&lt;/p&gt;
&lt;p&gt;this is what’s called the &lt;em&gt;polar form&lt;/em&gt; (or exponential form) of a complex number, because the number outside the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/math&gt; is the &lt;em&gt;length&lt;/em&gt; of the resulting complex number, while the number in the exponential is the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;g&lt;/mi&gt;&lt;mi&gt;l&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/math&gt; between the complex number and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/math&gt;&lt;/p&gt;
&lt;p&gt;I used those vector terms because complex numbers actually map quite nicely to vectors, and by mapping vectors into complex space, operations can be done on them that have geometric meaning, mainly rotation. if we only care about rotational complex numbers, then &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/math&gt;, so no need to worry about that part.&lt;/p&gt;
&lt;p&gt;take this complex number (note: I am using &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;/math&gt; to mean &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/math&gt;):&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;
&lt;p&gt;look what happens when we multiply it by, say, &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;check that out! it sorta “rotated” that complex number 135 degrees. this is what stems from that polar transformation, and why it’s so useful for multiplying complex numbers together. you can do that same computation in the rectangular (“standard”) form of complex numbers and see that you end up with the same result&lt;/p&gt;
&lt;p&gt;thus, if we use a mapping from a euclidean vector to the complex numbers, the polar form of a complex number &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt; can be interpreted as rotation by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt; in the xy plane.&lt;/p&gt;
&lt;section id=&quot;but-wait&quot;&gt;
&lt;h3&gt;but wait&lt;/h3&gt;
&lt;p&gt;there’s a &lt;em&gt;different&lt;/em&gt; way to convert a normalized complex number to the same polar form. instead of the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;atan&lt;/mi&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/math&gt; bit determining the sign of the thing, we can just use a “normalized” imaginary part, which with only 1 component means the sign of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/math&gt;. for determining the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt; of rotation, that’s just &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;acos&lt;/mi&gt;&lt;/mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;acos&lt;/mi&gt;&lt;/mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;
&lt;p&gt;do note that this &lt;em&gt;only&lt;/em&gt; works for magnitude-1 complex numbers, since the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;acos&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt; will start going imaginary outside of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mo&gt;,&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;/math&gt;. you can probably adapt this equation to be more general, but that’s not important for this at all. what’s important is that this works and will be relevant for the next section.&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id=&quot;quaternions&quot;&gt;
&lt;h2&gt;quaternions&lt;/h2&gt;
&lt;p&gt;how does this get adapted to quaternions? how do we get a quaternion to square to -1? well, as it turns out, any quaternion composed of only imaginary components that also has magnitude of 1 will square to -1:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mtext&gt;where&lt;/mtext&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msup&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;msup&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;.&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;this can be used to create the polar form of a normalized quaternion, derived directly from the way we did a normalized complex number:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mtext&gt;where&lt;/mtext&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;acos&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mfrac&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot; lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;|&lt;/mo&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mtext&gt;where&lt;/mtext&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;acos&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;6&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;6&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;6&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;this leads to a (tentative) geometric meaning of the polar quaternion &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mi&gt;𝐳&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;: it’ll rotate by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt; in the plane that gets defined by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;𝐳&lt;/mi&gt;&lt;/math&gt;. this plane can also be thought of as a vector axis with no loss of generality&lt;/p&gt;
&lt;p&gt;how does this manifest into reality? take a very simple quaternion &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/math&gt;. here &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/math&gt; would represent the x-y plane, or the upwards-pointing z axis, and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;8&lt;/mn&gt;&lt;/mfrac&gt;&lt;/math&gt; would represent a rotation of 45 degrees. so this should, somehow, rotate some mapping of a euclidean vector into the quaternions 45 degrees in the xy plane.&lt;/p&gt;
&lt;p&gt;the “some mapping” there is the key crux here. in the complex number system, a simple mapping from a euclidean vector to the real and imaginary part worked wonderfully, but there’s a less clear idea here. there’s three imaginary parts and 1 real part. if we use one real part like the complex numbers, one of the imaginary numbers gets left out. that feels weird. so perhaps we can map vectors to the imaginary part and find something that comes from that&lt;/p&gt;
&lt;p&gt;so, taking the simple vector &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;⟨&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;,&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mo&gt;,&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;⟩&lt;/mo&gt;&lt;/math&gt;, this would get mapped to &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/math&gt;. in theory, our quaternion &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;/math&gt; would, when multiplied by this vector, perform a 45 degree rotation in the x-y plane, resulting in &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/math&gt;. does this come into fruition?&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;.&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;no.&lt;/p&gt;
&lt;p&gt;there’s one idea to try to remedy this: multiplying a quaternion (or any complex thing) by its conjugate will always result in a real number:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;¯&lt;/mo&gt;&lt;/mover&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐢𝐢&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐢𝐣&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐢𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐣𝐢&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐣𝐣&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐣𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐤𝐢&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐤𝐣&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐤𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;moreover, this real number will be equal to 1 with normalized quaternions. can this be used to “cancel” the adverse effect of the quaternion?&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;¯&lt;/mo&gt;&lt;/mover&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐢𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐤𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi&gt;𝐣𝐤&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;would you look at that. we’re no longer getting a weird quaternion that can’t be mapped back to a vector. this appeared to have rotated the vector in the x-y plane by &lt;em&gt;twice&lt;/em&gt; the angle specified by the quaternion. this is a general thing that can be applied to any quaternion. the construction of&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;
&lt;p&gt;will “rotate” the “vector” &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;/math&gt; by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt; radians in the plane defined by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mi&gt;𝐢&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mi&gt;𝐣&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mi&gt;𝐤&lt;/mi&gt;&lt;/math&gt; (or, as a more familiar notion, the axis defined by that imaginary quaternion)&lt;/p&gt;
&lt;section id=&quot;ok-now-polar-multiplication&quot;&gt;
&lt;h3&gt;ok now polar multiplication&lt;/h3&gt;
&lt;p&gt;now it’s time for the actual reason why I was going to write this. it was originally going to be just this part and nothing else, but that felt weird. everything before was review, now this is where intrigue sets in&lt;/p&gt;
&lt;p&gt;so, complex numbers can be composed via multiplication. you get a new complex number that represents both rotations at once. this is the same thing with quaternions: multiplying them gives you a new quaternion that represents applying one rotation and then the other.&lt;/p&gt;
&lt;p&gt;with complex numbers, multiplying is extremely easy in the exponential form:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;ϕ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;msub&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;ϕ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mi&gt;ϕ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;you can verify this by converting to and fro the two forms while multiplying them.&lt;/p&gt;
&lt;p&gt;however, this construct does &lt;strong&gt;not&lt;/strong&gt; generalize to the quaternion form:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mover&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;?&lt;/mi&gt;&lt;/mover&gt;&lt;mspace width=&quot;0.16666667em&quot;/&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;τ&lt;/mi&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msqrt&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mtext&gt;(this is useless)&lt;/mtext&gt;&lt;mi&gt;.&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;I believe this is because of the anticommutativity of quaternions. when converting to exponents and multiplying, that anticommutativity gets lost. I found &lt;a href=&quot;https://www.theworld.com/~sweetser/quaternions/quantum/polar/polar.html&quot;&gt;this page&lt;/a&gt; that describes a scheme for multiplying two polar quaternions, but I can’t really make sense of it. very bad notation on the page.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;something-about-clifford-algebra&quot;&gt;
&lt;h3&gt;something about clifford algebra&lt;/h3&gt;
&lt;p&gt;this section is unrelated to the polar stuff, but I do want to mention it&lt;/p&gt;
&lt;p&gt;complex numbers and quaternions seem to be fundamentally different from each other when viewed through this lens, but they’re actually subalgebras of a very general algebraic structure called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Clifford_algebra&quot;&gt;clifford algebra&lt;/a&gt;. this is not the post to start explaining what a clifford algebra is; I want to make something like that for realsies eventually. but the core idea is that the mappings used for complex/quaternion stuff, while they do enable for the transformations so long as rules are followed, are not very generalizable. how would these mappings be done in 4d? 5d? not the easiest.&lt;/p&gt;
&lt;p&gt;clifford algebra is a much more generalized framework that both complex numbers and quaternions are subalgebras of (as well as several, several other complex-like algebras). it separates the notion of a vector and what we consider “imaginary” sections of complex numbers/quaternions. after all, it’s a bit weird how in complex numbers, a 1:1 mapping from vectors to complex numbers can be done, but in quaternions, the mapping has to be done to the imaginary part only.&lt;/p&gt;
&lt;p&gt;I hinted at this by not refering to rotations as “around an axis” by default, but rather “in a plane” by default. this was a hint to the existence of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bivector&quot;&gt;bivectors&lt;/a&gt; and the different way of thought they bring to the table.&lt;/p&gt;
&lt;p&gt;but again, conversation for another day&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id=&quot;there-wasnt-really-a-point-to-this-post&quot;&gt;
&lt;h2&gt;there wasn’t really a point to this post&lt;/h2&gt;
&lt;p&gt;I kinda just wanted to coalesce this curiosity about quaternions in this post. there wasn’t really a point to it nor did I really desire to make it “organized”, which is probably evident. this was mainly trying to re-derive quaternion stuff without trying to say anything super formal or making absolute 100% sense of anything, but rather experimentation and seeing where ideas and threads lead.&lt;/p&gt;
&lt;p&gt;…but that seems to have become the point of the post. math is about doing experiments with structure, finding patterns, and seeing if those patterns have a relation to something more tangible. there’s no real “nice” way to fundamentally explain why the “sandwich” “product” exists other than it’s an interesting emergent pattern of the created algebra that was then realized to have geometric meaning. sometimes stuff &lt;em&gt;just happens&lt;/em&gt; in math, and we derive meaning from the things that happen. that’s what it’s all about! discovery, experimentation, and making relations.&lt;/p&gt;
&lt;p&gt;so, go out there and experiment&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>quickly converting djot to html+mathml</title>
			<link rel="alternate" href="/~yosh/blog/djot-to-html-with-mathml.html" />
			<id>urn:uuid:8ca225c3-375a-4d08-a2c1-c0b5462d656b</id>
			<published>2025-07-06T04:45:34Z</published>
			<updated>2026-03-26T21:00:00Z</updated>
			<content type="html">
&lt;p&gt;I write &lt;a href=&quot;https://djot.net&quot;&gt;djot&lt;/a&gt; instead of markdown for my site. I was enticed by the promises of speed and and an actually consistent syntax. check out how djot scales in file size compared to markdown, using the two fastest featureful parsers that I personally know of (&lt;a href=&quot;https://github.com/hellux/jotdown/tree/master&quot;&gt;jotdown&lt;/a&gt; for djot and &lt;a href=&quot;https://github.com/kristapsdz/lowdown&quot;&gt;lowdown&lt;/a&gt; for markdown):&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align: center;&quot;&gt;# of headings&lt;/th&gt;
&lt;th style=&quot;text-align: center;&quot;&gt;lowdown&lt;/th&gt;
&lt;th style=&quot;text-align: center;&quot;&gt;jotdown&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;1000&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;0.631s&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;0.023s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;2000&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;4.584s&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;0.085s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;3000&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;15.403s&lt;/td&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;0.188s&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;you can see that lowdown seemingly scales polynomially while jotdown scales linearly as more headings exist. probably similar with other kinds of environments. though, for my blog, I’m not really working with files of this size. the build time difference between lowdown and jotdown is negligible for me and probably always will be. oh well.&lt;/p&gt;
&lt;p&gt;in any case, I still find djot nicer to write. there’s less rules and ambiguity in the syntax. it’s a bit awkward how I have to make a new paragraph when writing nested lists, but that’s about my only reservation. one of the things I found neat about djot is that is has &lt;a href=&quot;https://htmlpreview.github.io/?https://github.com/jgm/djot/blob/master/doc/syntax.html#math&quot;&gt;a definite math syntax&lt;/a&gt;, when markdown parsers with a LaTeX math extension need to fiddle with that awkward double dollar sign syntax. I’ve experienced it exploding once when I was writing physics notes in markdown some years ago.&lt;/p&gt;
&lt;p&gt;here’s how jotdown parses a math block:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cat math.djot
## check out this matrix

$$`
\begin{bmatrix}
	1 &amp;amp; 0 \\
	0 &amp;amp; 1
\end{bmatrix}
`

cool, right?

$ jotdown math.djot
&amp;lt;section id=&quot;check-out-this-matrix&quot;&amp;gt;
&amp;lt;h2&amp;gt;check out this matrix&amp;lt;/h2&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;span class=&quot;math display&quot;&amp;gt;\[
\begin{bmatrix}
1 &amp;amp;amp; 0 \\
0 &amp;amp;amp; 1
\end{bmatrix}
\]&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;cool, right?&amp;lt;/p&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ah. it &lt;em&gt;parses&lt;/em&gt; the math and spits it out, but it doesn’t exactly &lt;em&gt;do anything&lt;/em&gt; with it spare surround it with the proper LaTeX display/inline math delimiters. when making &lt;a href=&quot;shearing-with-rotation-and-scaling.html&quot;&gt;my blog post about shearing&lt;/a&gt;, I externalized all the mathml parsing to &lt;a href=&quot;https://math.nist.gov/~BMiller/LaTeXML/get.html&quot;&gt;LaTeXML&lt;/a&gt; and &lt;a href=&quot;https://git.unix.dog/yosh/website/src/commit/8c7ccced37469d8ce2a101927186b1f811468660/src/blog/shearing-with-rotation-and-scaling.djot#L61&quot;&gt;raw-inlined the math into the djot&lt;/a&gt;. this was really annoying for two reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
whenever I wanted to edit an equation after editing a bunch of other stuff or having closed my editor, I had to reconstruct the LaTeX from the annotation that LaTeXML makes. the program minifies and slightly changes the styling of the math, so it took a bit of time to mentally parse and edit.
&lt;/li&gt;
&lt;li&gt;
the file became incredibly difficult to navigate in general. I &lt;a href=&quot;https://www.youtube.com/watch?v=5WLlLxU2EZE&amp;amp;t=10m11s&quot;&gt;use soft wrapping in kakoune&lt;/a&gt;, not hard wrapping, and the entire blob of mathml for every equation made navigation clunky
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;it wasn’t until about two days ago that I learned that &lt;a href=&quot;https://pandoc.org/&quot;&gt;pandoc&lt;/a&gt; is able to do this fine:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ pandoc -f djot --mathml math.djot
&amp;lt;h2 id=&quot;check-out-this-matrix&quot;&amp;gt;check out this matrix&amp;lt;/h2&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;math display=&quot;block&quot; xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&amp;gt;&amp;lt;semantics&amp;gt;&amp;lt;mrow&amp;gt;&amp;lt;mo stretchy=&quot;true&quot; form=&quot;prefix&quot;&amp;gt;[&amp;lt;/mo&amp;gt;&amp;lt;mtable&amp;gt;&amp;lt;mtr&amp;gt;&amp;lt;mtd columnalign=&quot;center&quot; style=&quot;text-align: center&quot;&amp;gt;&amp;lt;mn&amp;gt;1&amp;lt;/mn&amp;gt;&amp;lt;/mtd&amp;gt;&amp;lt;mtd columnalign=&quot;center&quot; style=&quot;text-align: center&quot;&amp;gt;&amp;lt;mn&amp;gt;0&amp;lt;/mn&amp;gt;&amp;lt;/mtd&amp;gt;&amp;lt;/mtr&amp;gt;&amp;lt;mtr&amp;gt;&amp;lt;mtd columnalign=&quot;center&quot; style=&quot;text-align: center&quot;&amp;gt;&amp;lt;mn&amp;gt;0&amp;lt;/mn&amp;gt;&amp;lt;/mtd&amp;gt;&amp;lt;mtd columnalign=&quot;center&quot; style=&quot;text-align: center&quot;&amp;gt;&amp;lt;mn&amp;gt;1&amp;lt;/mn&amp;gt;&amp;lt;/mtd&amp;gt;&amp;lt;/mtr&amp;gt;&amp;lt;/mtable&amp;gt;&amp;lt;mo stretchy=&quot;true&quot; form=&quot;postfix&quot;&amp;gt;]&amp;lt;/mo&amp;gt;&amp;lt;/mrow&amp;gt;&amp;lt;annotation encoding=&quot;application/x-tex&quot;&amp;gt;
\begin{bmatrix}
1 &amp;amp;amp; 0 \\
0 &amp;amp;amp; 1
\end{bmatrix}
&amp;lt;/annotation&amp;gt;&amp;lt;/semantics&amp;gt;&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;cool, right?&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;…but if I built my site with pandoc instead of jotdown, my build time septuples since &lt;a href=&quot;https://git.unix.dog/yosh/website/src/commit/e4d6236cdcea8b36fb13dd3557ccd32351556cfd/include/_djot-template.shp#L29&quot;&gt;I call it for every markdown file&lt;/a&gt;. currently, it takes about 0.17 seconds to build my site when using jotdown and 1.3 seconds if I use pandoc instead. not great, especially if I were to add a bunch more djot files, I’d imagine!&lt;/p&gt;
&lt;p&gt;so I quickly hacked together &lt;a href=&quot;https://git.unix.dog/yosh/djot-to-html-and-mathml&quot;&gt;a little rust program&lt;/a&gt; that combines the jotdown library with &lt;a href=&quot;https://github.com/tmke8/math-core&quot;&gt;the math-core crate for rendering mathml from LaTeX&lt;/a&gt;. I’ve never written rust before, so it’s &lt;a href=&quot;https://git.unix.dog/yosh/djot-to-html-and-mathml/issues/1&quot;&gt;not exactly perfect&lt;/a&gt;, but I don’t need it to be. &lt;a href=&quot;https://git.unix.dog/yosh/website/src/commit/6c1ee8161eea797d9a44356cd5763edd5993f2ce/src/blog/shearing-with-rotation-and-scaling.djot&quot;&gt;it works for me&lt;/a&gt;! maybe it’ll work for you too.&lt;/p&gt;
&lt;section id=&quot;update-2026-03-26&quot;&gt;
&lt;h2&gt;update (2026-03-26)&lt;/h2&gt;
&lt;p&gt;I made &lt;a href=&quot;https://git.unix.dog/yosh/djot-to-html-and-mathml/src/branch/main/src/htmathml.rs&quot;&gt;a custom renderer&lt;/a&gt; that fixes that issue mentioned earlier, so now it’s pretty much perfect for my use case!&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>representing a shear/skew with only rotation and scaling</title>
			<link rel="alternate" href="/~yosh/blog/shearing-with-rotation-and-scaling.html" />
			<id>urn:uuid:7e0dec0f-b5e8-465d-ab13-efbc32b5a741</id>
			<published>2025-06-26T08:07:00Z</published>
			<updated>2025-06-26T08:07:00Z</updated>
			<content type="html">
&lt;p&gt;clickbait title: “rederiving an extremely elegant equation from a classic 1990 computer graphics book”&lt;/p&gt;
&lt;p&gt;&lt;em&gt;note: this post uses &lt;a href=&quot;https://en.wikipedia.org/wiki/MathML&quot;&gt;MathML&lt;/a&gt; for formatting the math. this is supported by all the major browsers (I tested chromium, firefox, and pale moon), but more obscure browsers might not render it&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I’m in &lt;a href=&quot;https://resonite.com&quot;&gt;resonite&lt;/a&gt;—as I am—hanging out with some critters in a world—as one does. sparsely out of the corner of my eyes and ears, I oversee and overhear someone else in the session messing about with a cube, cursing at how the math they’re doing isn’t working out. of course, I hear the word “math” and perk up immediately, going over to observe their happenings. what was their plight? what accursed math must they be doing to provoke this reaction? fumbling with quaternions? higher-dimensional happenings and mappings?&lt;/p&gt;
&lt;p&gt;turns out, they just wanted to shear a cube. that’s right—this funny little transformation:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:SVG_skewX.svg&quot;&gt;&lt;img alt=&quot;A shear mapping&quot; src=&quot;/~yosh/img/blog/shear_square.svg&quot;/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and it was ending up being harder than they thought. I was then &lt;s&gt;conscripted&lt;/s&gt; &lt;a href=&quot;https://xkcd.com/356/&quot;&gt;nerd sniped&lt;/a&gt; into figuring this out as well, which took up approximately four full days of time thinking about this problem and gaining knowledge of a neat little linear algebra thing in the process, hence why I am writing this post about it.&lt;/p&gt;
&lt;p&gt;for reference, in resonite, components for meshes, rendering, all the like are attached to things called “slots”. these slots make up a hierarchy in the world, and each slot can have a transformation applied to it. however, you only have access to translation, rotation, and scaling on any individual slot. as such, if you want to express complex, arbitrary transformations on components, you have to compose the transformations on these individual slots. you do not have access to arbitrary transformations directly—all transformations have to eventually be represented in this hierarchy of slots alone.&lt;/p&gt;
&lt;p&gt;as an example, if I want to stretch out a cube along one of its axis-aligned diagonal, I have to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
rotate the cube by 45 degrees (inner slot)
&lt;/li&gt;
&lt;li&gt;
scale the cube in the desired direction (outer slot)
&lt;/li&gt;
&lt;li&gt;
rotate the cube back 45 degrees (outer slot)
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=&quot;A visual demonstration of the above steps&quot; src=&quot;/~yosh/img/blog/shear_boxcorners.png&quot;/&gt;&lt;/p&gt;
&lt;p&gt;now you might be able to see where the problem lies.&lt;/p&gt;
&lt;section id=&quot;my-initial-attempt&quot;&gt;
&lt;h2&gt;my initial attempt&lt;/h2&gt;
&lt;p&gt;I came into this armed with a heap of trigonometry knowledge, so I took a crack at trying to solve this myself. I &amp;amp; the other critter came up with the process of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
rotate the object 45 degrees towards the skew direction
&lt;/li&gt;
&lt;li&gt;
scale the object in the direction of skew
&lt;/li&gt;
&lt;li&gt;
undo the rotation with some trig at the end
&lt;/li&gt;
&lt;li&gt;
undo the deformation that results from the scaling in step 2
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;and I was the one to figure out the number crunching and equation solving for it.&lt;/p&gt;
&lt;p&gt;this idea actually worked!… kinda. there were two issues with it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
it required four transformations, or at minimum 3 slots (the scale and undo-rotation in step 2 and 3 can be done in one slot). I was under the impression that this &lt;em&gt;has&lt;/em&gt; to be possible in only 3 transformations, or two slots
&lt;/li&gt;
&lt;li&gt;
it only worked for angles up to 45 degrees. while the object can stretch infinitely long in step 2, that stretch has to be compensated for in step 4 to preserve the side lengths on axes that shouldn’t be affected by the skew. this would cause the transformation to get closer and closer to 45 degrees… but never truly reach it.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;here’s the three pages of work I scrawled while figuring out this method:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Three pages of trigonometry. there’s a lot of functions, rhombuses, and triangles present.&quot; src=&quot;/~yosh/img/blog/shear_work_mymethod.webp&quot;/&gt;&lt;/p&gt;
&lt;p&gt;you can notice how I had the idea of using non-45 degree angles to prevent the limit that 45 degrees caused, but analyzing that with only trigonometry got way too unwieldy for me to pursue. as such, I decided that it was time to start thinking more analytically&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;problem-statement&quot;&gt;
&lt;h2&gt;problem statement&lt;/h2&gt;
&lt;p&gt;the basic premise of a shear/skew is this: we want to scale one axis based on how far along another axis we are. this causes points close to the zero line of the shear axis to move only a little bit, while points far away from the shear axis to move a lot. this can be seen visually in the image back at the top of this post.&lt;/p&gt;
&lt;p&gt;to progress in this endeavor, however, it would help a lot to represent this analytically. we leave the land of geometry and trig for the land of &lt;a href=&quot;https://en.wikipedia.org/wiki/Transformation_matrix&quot;&gt;matrices&lt;/a&gt;. unfortunately, I will not be explaining everything there is to do with matrices for this post—it would be too much and sprawl the post out too much—but there are excellent resources online to get started with them. to reduce clutter further, I will only be looking at the 2d case throughout most of this post—the 3d case follows directly from the 2d concepts.&lt;/p&gt;
&lt;p&gt;to begin, a shearing matrix looks like this:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;this accomplishes our goal of scaling one axis as we move along the other axis:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;now, we want to represent this matrix with rotations and scaling only. I’ll save the complications and just state that translation is not needed throughout this entire thing. as a refresher, a rotation matrix looks like this:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;sin&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;cos&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;and a scale matrix looks like this:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;and to “compose” transformations, we just multiply the matrices together.&lt;/p&gt;
&lt;p&gt;you can glance at these three matrices and quickly realize that this isn’t quite as trivial as it may seem. figuring out some special rotation and scale constants to cancel everything out to 1 along the diagonal, 0 in the bottom left, and a nonzero term in the top right is not something that can just be done in a human brain.&lt;/p&gt;
&lt;p&gt;usually, when pursuing such a question, it’s best to first see if anyone else thought of this problem as well. time to start researching.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;research&quot;&gt;
&lt;h2&gt;research&lt;/h2&gt;
&lt;p&gt;there’s not much existing information online about this specific conundrum. turns out, in most places where this might be an issue (such as Unity), you have access to arbitrary shader code, which means arbitrary transformations either way. it makes this kind of thing extremely niche and only really relevant in places where you’re hard-constrained to these basic three transformations—which describes my situation exactly.&lt;/p&gt;
&lt;p&gt;nonetheless, I did find a few hints at a direction to look in, thanks to stackoverflow:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://stackoverflow.com/questions/18362043&quot;&gt;Shear Matrix as a combination of basic transformation?&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://stackoverflow.com/questions/54219725&quot;&gt;Multiple-shear matrix as combination of rotation, non-uniform scale, and rotation?&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;both of these questions pointed towards something I haven’t heard before—this thing called the “SVD”. following one of the links &lt;a href=&quot;https://www.cs.cmu.edu/%7Edjames/15-462/Fall03/assts/15-462-Fall03-wrAssign1-answer.pdf&quot;&gt;to this college homework assignment from 2003&lt;/a&gt;, question 3 gives more insight on this whole thing. while it displays a formula for a special case of a shear matrix—where the shear factor is &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mfrac&gt;&lt;/math&gt;—this is not a general form that made me happy. looking at the end of the question, a particular book is referenced: “Graphics Gems I”, page 485.&lt;/p&gt;
&lt;p&gt;I acquired that book and went to the page in question. there, the following equation is presented without comment:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;The equation from Graphics Gems I, showcasing a lot of square roots and tangents&quot; src=&quot;/~yosh/img/blog/shear_graphicsgems.png&quot;/&gt;&lt;/p&gt;
&lt;p&gt;for some reason—and I didn’t realize this until writing this post—this section of the book (unsure about the whole book) shows all the matrices as their &lt;em&gt;transposes&lt;/em&gt; than what you’d expect. their rotations are clockwise by default rather than counterclockwise by default—their skews not aligned with current conventions. they might be doing their matrix multiplication as right multiplications rather than the conventional left multiplication.&lt;/p&gt;
&lt;p&gt;to translate this from the primitive formatting and backwards convention of the book, it states the following:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0.1667em&quot;&gt;tan&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo lspace=&quot;0.2222em&quot; rspace=&quot;0.2222em&quot;&gt;×&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo lspace=&quot;0.2222em&quot; rspace=&quot;0.2222em&quot;&gt;×&lt;/mo&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/math&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;tan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;±&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;tan&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;/math&gt; is the rotation matrix as described above. if you want to change the direction of shear, you can simply swap the scale values and axis of rotation.&lt;/p&gt;
&lt;p&gt;what a neat and elegant equation! I noticed that the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;tan&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/math&gt; part was only necessary for knowing the angle of shear, and that I can just replace all the tangents in the equation with just a constant “shear factor”, simplifying it a bit.&lt;/p&gt;
&lt;p&gt;I went ahead and ported this to protoflux—resonite’s node-based programming language for this kind of thing—and it just, worked perfectly fine.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;A cube being sheared in resonite&quot; src=&quot;/~yosh/img/blog/shear_port1.webp&quot;/&gt;&lt;/p&gt;
&lt;p&gt;I was simultaneously excited that I found an implementation that worked, but also incredibly disappointed that I had no idea &lt;em&gt;how&lt;/em&gt; it worked. how did they derive this? what thought process went in to this? of course, the book itself didn’t derive it at all. nothing in that entire section leds up to that formula, nor did they give any hint at how to derive it in the first place.&lt;/p&gt;
&lt;p&gt;but if you remember, I was given a hint from stackoverflow &amp;amp; the homework: this silly little thing called the “singular value decomposition”&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;what-the-hell-is-a-singular-value&quot;&gt;
&lt;h2&gt;what the hell is a singular value&lt;/h2&gt;
&lt;p&gt;if you try and search what the singular value decomposition is online, chances are that you’ll get swamped with formalisms and definitions and have a very hard time. I was like this when looking at &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot;&gt;the wikipedia article about the subject&lt;/a&gt;, and I ended up obsessing over everything when it didn’t quite matter all the time.&lt;/p&gt;
&lt;p&gt;I’ll assume you already know what a matrix is, the basic operations on them, and a few basic linear algebra terms related to them. I kinda already did that up above. it’ll also be helpful to know what an &lt;i&gt;eigenvalue&lt;/i&gt; and &lt;i&gt;eigenvector&lt;/i&gt; is. if you don’t, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors#Eigenvalues_and_eigenvectors_of_matrices&quot;&gt;wikipedia page for them&lt;/a&gt; is much more practically understandable than the SVD page.&lt;/p&gt;
&lt;p&gt;before explaining the SVD, there’s a few quick facts you should internalize first:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
the eigenvalues of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; are the same.
&lt;/li&gt;
&lt;li&gt;
the matrix products &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; are both symmetric matrices. this means that, for both of the matrices, their eigenvectors are orthogonal to each other, and thus can be used to construct an &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthogonal_matrix&quot;&gt;orthogonal matrix&lt;/a&gt; if you normalize them.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;with these two facts in mind, here’s an hopefully intuitive understanding of what the SVD is, starting with an informal definition and building on it:&lt;/p&gt;
&lt;p&gt;any matrix—and thus any linear transformation—can be represented as a multiplication of three special matrices:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;/math&gt;: an orthogonal matrix
&lt;/li&gt;
&lt;li&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;: a &lt;a href=&quot;https://en.wikipedia.org/wiki/Diagonal_matrix&quot;&gt;diagonal matrix&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;: a transpose of another orthogonal matrix, which means that it itself is also orthogonal
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;this is commonly notated like &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;msup&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;.&lt;/p&gt;
&lt;p&gt;what does this mean for transformations? well, an orthogonal matrix is used to rotate things, and a diagonal matrix is used to scale things, so… any linear transformation can be represented as a rotation, followed by some scale, followed by another rotation. pretty neat, isn’t it?&lt;/p&gt;
&lt;p&gt;to get specific about what these values are, the columns of the &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;/math&gt; matrices are made up of the normalized eigenvectors of the matrices &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;, respectively. these two sets of eigenvectors are called the &lt;i&gt;left singular vectors&lt;/i&gt; and &lt;i&gt;right singular vectors&lt;/i&gt;, respectively. the entries along the diagonal of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt; are the square roots of the eigenvalues of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; (since these two matrices have the same eigenvalues). they should align in the same columns as their corresponding eigenvectors in the other two matrices, and the most common convention for this is to put them in descending order along the diagonal.&lt;/p&gt;
&lt;section id=&quot;why-does-this-work&quot;&gt;
&lt;h3&gt;why does this work?&lt;/h3&gt;
&lt;p&gt;recall what eigenvalues and eigenvectors are for a minute. if we can represent a matrix multiplied with a vector as a &lt;em&gt;scalar&lt;/em&gt; multiplied with said vector, what would happen if we had a way to make a “base” of orthogonal eigenvectors, applying different scales to each eigenvector? we’d be able to represent that matrix transformation with only scaling. this is the essence of the SVD.&lt;/p&gt;
&lt;p&gt;keeping in mind that the convention is to left-multiply the transformation matrix against the vector, this is the order of transformations:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
when multiplying by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;, we rotate our coordinate space from our original basis—what we’d consider the “x” and “y” unit vectors geometrically—to the basis of the eigenvectors of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;.
&lt;/li&gt;
&lt;li&gt;
now that we’re in this coordinate space, we use the singular values to perform the transformation of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; in the eigenspace of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;.
&lt;ul&gt;
&lt;li&gt;
I was confused as to &lt;em&gt;why&lt;/em&gt; these singular values did this transformation, but I &lt;em&gt;think&lt;/em&gt; I get it now. conventionally, when you square a matrix, the eigenvalues of that new matrix are the eigenvalues of the original matrix squared. this is not the case when you multiply a matrix by its transpose. however, when we’re in the basis of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;, the eigenvalues of that product are doing that transformation in that basis, but squared. we have to account for this by square rooting the eigenvalues. this is just my line of reasoning that I am attempting to deduce from this and is in no way formal. if someone who knows about this more than me sees this and it’s completely wrong, let me know and I’ll edit this!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
finally, after we do the transformation, we need to rotate back to our original basis. therefore, we multiply by &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;/math&gt; composed of the left singular vectors.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id=&quot;deriving-the-shear-case&quot;&gt;
&lt;h2&gt;deriving the shear case&lt;/h2&gt;
&lt;p&gt;that’s all well and good, but this was supposed to be about the shear transformation! oh dear. I’m 170 or so lines into this djot file and haven’t talked about the shear transformation yet. but no longer! because I will finally be showcasing the derivation of that one equation that I was so obsessed over. this will serve both as a more accessible reference for this equation, as well as a complete workout of computing the singular value decomposition, since there’s a severe lack of that on the internet. let’s go!&lt;/p&gt;
&lt;p&gt;remember: the shear matrix looks like so:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;section id=&quot;the-singular-values&quot;&gt;
&lt;h3&gt;the singular values&lt;/h3&gt;
&lt;p&gt;we first compute &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;then we compute the eigenvalues of either of these two matrices. we don’t need to do both, since the eigenvalues for the two matrices are the same. going against &lt;a href=&quot;https://www.axler.net/DwD.html&quot;&gt;sheldon axler&lt;/a&gt; for a moment here, we’ll get the characteristic polynomial:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mtext&gt;det&lt;/mtext&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;and solve for the eigenvalues, this time simply with the quadratic equation:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;±&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;msup&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;±&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;±&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;I’ll split the two eigenvalues up like so:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;where the square root always represents the positive square root.&lt;/p&gt;
&lt;p&gt;note how &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;&amp;gt;&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt; for all values of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/math&gt;.&lt;/p&gt;
&lt;p&gt;to get the singular values from these, all we need to do is take the square root of these eigenvalues:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/msqrt&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;msqrt&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;/msqrt&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;you can go through these same motions for &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt; to find &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;in the context of the SVD, these singular values are used to construct &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;, the middle matrix, by placing them along the diagonals. the order of these values doesn’t really matter so long as the singular vectors corresponding to said eigenvalues are placed in the same columns of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;. however, it’s a common convention to sort them in a descending order, making our middle matrix:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;if you remember what the equation says, this seems ridiculous! both diagonal entries are stated in terms of only one number, not two like we have here. to remedy this, we can pull off some neat little algebra for a cool result:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;which makes our &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/section&gt;
&lt;section id=&quot;right-singular-vectors&quot;&gt;
&lt;h3&gt;right singular vectors&lt;/h3&gt;
&lt;p&gt;now we need to find the eigenvectors of both of the matrices. even though the eigenvalues are the same, the eigenvectors are not. starting with the right singular vectors, we need to find the eigenvectors of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; corresponding to our two eigenvalues:&lt;/p&gt;
&lt;p&gt;starting with &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;𝟎&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo stretchy=&quot;false&quot;&gt;⇒&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;{&lt;/mo&gt;&lt;mtable&gt;&lt;mtr&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;⁣&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo stretchy=&quot;false&quot;&gt;⇒&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mtext&gt;(Using 1st equation)&lt;/mtext&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo stretchy=&quot;false&quot;&gt;⇒&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo stretchy=&quot;false&quot;&gt;⇒&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;now we need to &lt;em&gt;normalize&lt;/em&gt; this vector such that it can be used in an orthogonal matrix. if we look at the reciprocal of its length:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mrow&gt;&lt;mo&gt;‖&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;‖&lt;/mo&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msubsup&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msubsup&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;/math&gt;
&lt;p&gt;hey, wait a minute… if we refer to &lt;a href=&quot;https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Relationships_between_trigonometric_functions_and_inverse_trigonometric_functions&quot;&gt;wikipedia’s table of inverse trig identities&lt;/a&gt;, this is an identity!&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msubsup&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msubsup&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mfrac&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;this makes the normalized form of the eigenvector extremely simple:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mfrac&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mrow&gt;&lt;mo&gt;‖&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;‖&lt;/mo&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;hooray! we have computed one of the right singular vectors of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt;.&lt;/p&gt;
&lt;p&gt;for brevity’s sake, I will not go through this entire process again for the other three eigenvectors we need. with all that I have stated in this post, one is able to go through roughly the same motions for the rest of the eigenvectors of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;. think of it as an exercise for the reader.&lt;/p&gt;
&lt;p&gt;anyway, if you go through that process again for &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt;, we can get our second right singular vector:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;and with that, we now know the columns of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;/math&gt;! making sure to line up our singular vectors with the singular values in &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;, we get:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mtext&gt;where&lt;/mtext&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;/section&gt;
&lt;section id=&quot;left-singular-vectors&quot;&gt;
&lt;h3&gt;left singular vectors&lt;/h3&gt;
&lt;p&gt;if you go through the same motions as the right singular vectors but for the matrix &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/math&gt;, you will find the left singular vectors. without any simplification further than what I did for the right singular vectors, I found:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;𝐯&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mtext&gt;where&lt;/mtext&gt;&lt;mspace width=&quot;1em&quot;/&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;making our &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;/math&gt; matrix:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/section&gt;
&lt;section id=&quot;putting-it-all-together&quot;&gt;
&lt;h3&gt;putting it all together&lt;/h3&gt;
&lt;p&gt;finally, after all that math, we have our decomposition! our funny shear matrix, represented as a multiplication of an orthogonal, scaling, then other orthogonal matrix, is:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;msup&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;…wait a second. this doesn’t look like what we want at &lt;em&gt;all&lt;/em&gt;. those two orthogonal matrices aren’t proper rotation matrices, so we can’t use them in slot transforms. and wait, scaling by a negative number? that’s prone to breaking a lot of things! certainly, this isn’t the end of the line. we need to do a little matrix algebra.&lt;/p&gt;
&lt;p&gt;first off, we can change &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt; to &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/math&gt;, knowing that &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;which makes &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;/math&gt; look like a proper rotation matrix&lt;/p&gt;
&lt;p&gt;second, we can split up &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt; into two matrices:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;and since &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_multiplication#Associativity&quot;&gt;matrix multiplication is associative&lt;/a&gt;, we can multiply &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;/math&gt; by the matrix shown on the left:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;finally, knowing that &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt; and &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;o&lt;/mi&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;after putting all of that together, and renaming &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msub&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;/msub&gt;&lt;/math&gt; to &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/math&gt; because I think it looks nicer, we end up with:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;U&lt;/mi&gt;&lt;mrow&gt;&lt;mspace/&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;Σ&lt;/mi&gt;&lt;/mrow&gt;&lt;msup&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;/msup&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mfrac&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;sin&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mo lspace=&quot;0.1667em&quot; rspace=&quot;0&quot;&gt;cos&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mtable displaystyle=&quot;true&quot; scriptlevel=&quot;0&quot; style=&quot;width: 100%&quot;&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mfrac&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: right;justify-items: end;padding-right: 0;&quot;&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd style=&quot;text-align: left;justify-items: start;padding-left: 0;&quot;&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;−&lt;/mo&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0&quot;&gt;arctan&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mtd&gt;&lt;mtd style=&quot;width: 50%&quot;&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/math&gt;
&lt;p&gt;this is exactly what we wanted! in the book equation, they use &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mo lspace=&quot;0&quot; rspace=&quot;0.1667em&quot;&gt;tan&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/math&gt; instead of &lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/math&gt; to have an “angle” of shear rather than a ratio of shear, but nonetheless, it functions the same!&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;unpacked protoflux of a cube being sheared with a factor of 0.5 along the x axis&quot; src=&quot;/~yosh/img/blog/shear_port2.webp&quot;/&gt;&lt;/p&gt;
&lt;p&gt;the above image shows shearing the x axis with respect to the y axis. switching these two axes is quite easy—it’s a matter of just swapping some values around. you can even “combine” two shears like this under four slots, so long as they don’t create a loop of shearing, as that’d result in a wrong shear.&lt;/p&gt;
&lt;p&gt;you can find a doodad for this in resonite in my public folder, under &lt;code&gt;Plux/Tidbits&lt;/code&gt;: &lt;code&gt;resrec:///U-yosh/R-397fd2e1-f035-4dbd-a5e5-217a1f8eb95c&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and, for completion’s sake, here’s the four main pages of work that I did for this problem:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;four pages of dense math&quot; src=&quot;/~yosh/img/blog/shear_work_svd.webp&quot;/&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id=&quot;further-endeavors&quot;&gt;
&lt;h2&gt;further endeavors&lt;/h2&gt;
&lt;p&gt;I want to eventually derive the same equation for an arbitrary 3x3 “shear” matrix:&lt;/p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mo&gt;[&lt;/mo&gt;&lt;mtable displaystyle=&quot;false&quot; scriptlevel=&quot;0&quot;&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;mo&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;p&gt;but that will be for when I’m particularly bored one day, as I don’t envision it to be very fun, even when I can get wolfram alpha to do lots of the heavy lifting for me.&lt;/p&gt;
&lt;p&gt;perhaps other funny matrix transformations can be derived in a similar way&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>I don&apos;t want to watch videos</title>
			<link rel="alternate" href="/~yosh/blog/i-dont-want-to-watch-videos.html" />
			<id>urn:uuid:84bebcf6-0e41-479f-8807-6b541a227edc</id>
			<published>2025-01-09T10:34:49Z</published>
			<updated>2025-01-09T10:34:49Z</updated>
			<content type="html">
&lt;p&gt;I join a session on resonite. it’s a gridspace—or maybe a small, quaint little hangout. my friends are in there. I like my friends. but I join—I wander, wander, eventually finding the critters—and see nothing but empty husks of models surrounding a flat video player. smack dab in the middle of a random room.&lt;/p&gt;
&lt;p&gt;I leave, usually&lt;/p&gt;
&lt;p&gt;I don’t need any auditory gaps to be filled. I don’t need to give my brain stimulation through empty &lt;a href=&quot;./stop-saying-content.html&quot;&gt;Content&lt;/a&gt;. I don’t need every moment of my time in this digital space to be filled with noise&lt;/p&gt;
&lt;p&gt;and I especially don’t want to watch a meme compilation.&lt;/p&gt;
&lt;p&gt;at best, I can play along. on average, I turn the volume off. if I’m sufficiently annoyed or out of it, I will leave. I feel like shit when I do. I feel like I don’t fit. almost none of the time do I want to drop everything to watch a video in a social space. it’s almost always not something I’m interested in, for one. for two, if I’m in a social space, I usually want to be &lt;strong&gt;social&lt;/strong&gt;, damnit&lt;/p&gt;
&lt;p&gt;I don’t care about this 20 minute eccentrically edited video of some guy making a thing. I’d rather read a blog post about it. I don’t care about this hit new piece of tech that I won’t buy. it’s probably going to be discontinued in half a year and sends your data to 50 billion advertisers. I don’t care about this twitch streamer e-celeb that’s always loud and relies on the parasocial bond between themselves and a soulless chat. almost all of them I can’t stand, spare a small and select few&lt;/p&gt;
&lt;p&gt;I don’t want to zombie out at a “try not to laugh” compilation where everything is stolen from 3 places anyway. feeling like shit the whole time usually means I’m not laughing&lt;/p&gt;
&lt;p&gt;tell me about your day. tell me about your latest interest. tell me about any interest you have. what you’re working on. how’s life. what’s life. how was the weather today. I don’t know man. I’d rather share the silence than try and fill its blissful emptiness with artificial noise from a source that shouldn’t even be in the conversation.&lt;/p&gt;
&lt;p&gt;the silence is social. we experience the silence together. we can envelop ourselves in its odd warmth.&lt;/p&gt;
&lt;p&gt;it’s boring, but it’s a boring that leaves you content. silence is what true freedom is&lt;/p&gt;
&lt;p&gt;I feel more lonely watching Content with others than sitting in silence with myself. I feel more together sitting and doing nothing with another critter than softening my brain with a recap of a movie everyone in the room has already watched. and if a video is less than 60 seconds and 9:16, the volume’s going to zero faster than what gravity could do.&lt;/p&gt;
&lt;p&gt;I don’t have all the answers. I don’t know what to say myself a lot of the time. so I won’t expect other critters to force words out of their maws. but silence is more than enough&lt;/p&gt;
&lt;p&gt;I just really, really don’t want to watch a video&lt;/p&gt;</content>
		</entry><entry>
			<title>composable keybinds should be everywhere</title>
			<link rel="alternate" href="/~yosh/blog/composable-keybinds-should-be-everywhere.html" />
			<id>urn:uuid:dde8f8fb-3fde-4aab-9b26-c6c09a85e93d</id>
			<published>2024-09-23T13:21:40Z</published>
			<updated>2024-09-23T13:21:40Z</updated>
			<content type="html">
&lt;p&gt;the title is a little clickbait—it should really be “composable keybinds should be in a lot more places than just text editors”, but that’s a little long for a blog title.&lt;/p&gt;
&lt;p&gt;I started using vim when I started using linux basically. I can’t remember why exactly I started—was it because of the claim of “vim is crazy efficient” or “vim is everywhere” in an effort to be hip with the cool linux kids? not sure. in any case, I really enjoyed working with it! I never really got too deep into vim-fu—trying to puzzle out the exact obscure editing commands that would minimize keystrokes and save like… maybe 0.5 seconds at most compared to no-brain doing “less optimal” keystrokes wasn’t really my thing&lt;/p&gt;
&lt;p&gt;I switched to &lt;a href=&quot;https://kakoune.org/&quot;&gt;kakoune&lt;/a&gt; for my text editing work some months ago, but that’s not the point of this post (debate the editor war on your own time). the point is, vim’s composing-keybinding style stuck with me, and seeing that kakoune is an editor inspired heavily by vim, I wanted to try it as well! the way kakoune approached its model editing flow felt like a nice, fresh experiment compared to vim, which kept me around to using it and eventually just removing vim from my system as a whole&lt;/p&gt;
&lt;p&gt;the main takeaway is that I think composing keybinds is a bit… under-represented in the software sphere right now. we really only have it in text editors, and really only because vi existed all that time ago. and yet, for some use cases, I must wonder how keybindings could be if they were made “modal” or “composing”, and whether they’d work better for the application’s purpose, if not just for me&lt;/p&gt;
&lt;section id=&quot;gimp-and-other-image-editors&quot;&gt;
&lt;h2&gt;gimp (and other image editors)&lt;/h2&gt;
&lt;p&gt;take gimp. it’s an image editor. it edits images. there’s a few different ways you can interact with an image in gimp:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
tools, like a paintbrush, pencil, fill, etc.
&lt;/li&gt;
&lt;li&gt;
filters, like a blur across the whole image, distortions, etc.
&lt;/li&gt;
&lt;li&gt;
selections, like rectangle, circle, etc.
&lt;/li&gt;
&lt;li&gt;
paths, like a curved path to fill in later or reference, text outline paths, etc.
&lt;/li&gt;
&lt;li&gt;
and many more…
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;the fact that one can group a bunch of related things screams composability to me. currently, I have &lt;code&gt;s&lt;/code&gt; bound to the rectangular select tool and &lt;code&gt;Shift+e&lt;/code&gt; bound to the ellipse tool, since &lt;code&gt;e&lt;/code&gt; normally is taken up by the eraser. I have &lt;code&gt;v&lt;/code&gt; for fuzzy select and &lt;code&gt;Shift+c&lt;/code&gt; for color select, since &lt;code&gt;c&lt;/code&gt; is for clone stamp and I just couldn’t find any other key that fuzzy select could be on. instead of having &lt;code&gt;s&lt;/code&gt; be meaningless on its own but rather a keybind specifically for rectangular selection, what if we had this schema:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;s&lt;/code&gt; -&amp;gt; enter selection mode
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;se&lt;/code&gt; -&amp;gt; select ellipse
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sr&lt;/code&gt; -&amp;gt; select rectangle
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ss&lt;/code&gt; -&amp;gt; select scissors
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sf&lt;/code&gt; -&amp;gt; select foreground
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sw&lt;/code&gt; -&amp;gt; select wand
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sc&lt;/code&gt; -&amp;gt; select color
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;not only does this allow for semantically sensible keybinds, but it additionally compartmentalizes keybinds into their own quarters of the application, allowing for the keyboard keys to be free for other modes and keybinds. this means we can make something like…&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;t&lt;/code&gt; -&amp;gt; enter tool mode
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;te&lt;/code&gt; -&amp;gt; eraser tool
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tf&lt;/code&gt; -&amp;gt; fill tool (gimp calls it “bucket fill”, but whatever)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tb&lt;/code&gt; -&amp;gt; brush tool
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tB&lt;/code&gt; -&amp;gt; pencil tool (as opposed to needing to use two hands/move a lot to reach &lt;code&gt;p&lt;/code&gt;)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tc&lt;/code&gt; -&amp;gt; clone stamp tool
&lt;/li&gt;
&lt;li&gt;
…
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;you can see the vision here right. because of having these separate “modes” to branch other keybinds off of, less cognitive overhead is spent trying to remember the obscure keybind you set a month ago or breaking your wrist to chord the correct keybind on one hand. yeah, maybe it’ll be slower compared to someone who &lt;em&gt;does&lt;/em&gt; know their existing keybinds like the back of their hand, but the speed difference is negligible for something like gimp (and arguably the speed difference modal editors do with their “hyper optimized bindings” is greatly exaggerated)&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;other-places&quot;&gt;
&lt;h2&gt;other places&lt;/h2&gt;
&lt;p&gt;I know blender has somewhat composable keybinds. some keybinds pop up a little menu that you can select from, but (I don’t think) you can compose another keybind to select something in that menu without using arrow keys or whatever. can’t remember—someone who has used blender more than I can probably chime in on this more. but in any case, it’d be nice to see proper modal editing and/or composable keybinds there&lt;/p&gt;
&lt;p&gt;I’ve used pentadactyl on pale moon for many years now. I like being able to use &lt;code&gt;gt/gr&lt;/code&gt; to go right and left in my tabs. I like &lt;code&gt;gg&lt;/code&gt; and &lt;code&gt;G&lt;/code&gt;. I like using &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;u&lt;/code&gt; to scroll pages, &lt;code&gt;p/P&lt;/code&gt; to paste a url, &lt;code&gt;t/T&lt;/code&gt; to open, &lt;code&gt;o/O&lt;/code&gt; to open, all the like. I’m not nearly an expert pentadactyl user—some things in a web browser are just better to do with a mouse—and the simple existence of “single/double key keybinds” isn’t exactly “modal” or “composability” to its fullest, but it’s a neat thing that I enjoy using and would like to see more&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;the-conclusion-paragraph&quot;&gt;
&lt;h2&gt;the conclusion paragraph&lt;/h2&gt;
&lt;p&gt;yeah this was kinda just a no brainer hour-long writing spree about this so I could get my thoughts all on one page. I’d like to see composable keybinds and “modes” of a program be explored more outside text editors, because I feel like there are places where they can work well. of course, not everywhere, but not an insignificant amount of applications. I think it’d be cool&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>stop saying &quot;content&quot;</title>
			<link rel="alternate" href="/~yosh/blog/stop-saying-content.html" />
			<id>urn:uuid:19db1beb-0c43-4fbd-9138-97d4bc3b5eed</id>
			<published>2024-07-20T20:15:44Z</published>
			<updated>2024-07-21T16:13:35Z</updated>
			<content type="html">
&lt;p&gt;this is a rant. it’s not meant to flow nice, like a serious post. it’s a dump of my mind&lt;/p&gt;
&lt;p&gt;I feel like a certain shift occurred within the past few years. a shift of semantics and how we refer to art and entertainment forms online. this shift is especially prevalent for videos, where historical evidence of only a few years ago (searching with &lt;code&gt;before:2021-01-01&lt;/code&gt; on google) represents such a stark shift in a short amount of time. it’s a shift that confuses me, leaves me befuddled, and weirdly like I’m the odd one out for noticing it, because I haven’t heard anyone else talk about it&lt;/p&gt;
&lt;p&gt;if someone makes a video, what words do we have to describe that video, and what words do we have to describe the video creator? if I make a long video covering a specific topic, delving into well-researched facts to tell a story, what video is that? by any reasonable merit, it is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Documentary_film&quot;&gt;documentary&lt;/a&gt;. short ones would be mini-docs. or docs! they don’t have to be long. and I’d be a &lt;a href=&quot;https://en.wiktionary.org/wiki/documentarian&quot;&gt;documentarian&lt;/a&gt;. if I make a shorter video—about 20 or so minutes—playing a video game with friends, what would that be? a &lt;a href=&quot;https://en.wikipedia.org/wiki/Let\'apos;s_Play&quot;&gt;let’s play&lt;/a&gt;? maybe, if the intent was of progression. recorded banter? maybe, if the game is more casual and quick. how about a blender animation? art? motion design? we have so many words to describe to many things. language is flexible and wide-spanning&lt;/p&gt;
&lt;p&gt;but this shift doesn’t respect that. it’s a shift that homogenizes—puts everyone in the same box—and dilutes the water for everyone.&lt;/p&gt;
&lt;p&gt;content.&lt;/p&gt;
&lt;p&gt;that word itches at me. does it itch at you? everything is content now. thanks for the content. I love your content. please make more &lt;strong&gt;content&lt;/strong&gt;. your &lt;strong&gt;content&lt;/strong&gt; is some of the best on the platform. wow, more &lt;strong&gt;content&lt;/strong&gt; from you.&lt;/p&gt;
&lt;p&gt;we’ve reached a point where &lt;a href=&quot;https://dice.camp/@drwho@hackers.town/112311138235703695&quot;&gt;concerts aren’t concerts&lt;/a&gt;. art is content. media is content. artists are content creators, no matter their profession. except maybe 2d illustrators. those aren’t content creators. those are still artists. vrchat avatar creator? no, vr content creator. resonite tool creator? no, resonite content creator. video game streamer? no, content creator. documentary? long-form content. videographer? content creator. urban explorer? content creator.&lt;/p&gt;
&lt;p&gt;it’s tiring&lt;/p&gt;
&lt;section id=&quot;why&quot;&gt;
&lt;h2&gt;why?&lt;/h2&gt;
&lt;p&gt;why have we gotten to this point? what caused it?&lt;/p&gt;
&lt;p&gt;I don’t know, really. a leading theory by a friend of mine is that influencers started realizing that people hated influencers, and decided to distance themselves from the term.&lt;/p&gt;
&lt;p&gt;that’s a nice theory, I guess, and I want to think it’s kind of true. I haven’t heard the term “influencer” used seriously in quite a while. rats, they all are.&lt;/p&gt;
&lt;p&gt;though I don’t think that’s the whole story. I think things kinda just, changed in our interfaces—how the corporate marketers described their userbase has shifted. a little, at least. youtube changed the description of “things uploaded on your channel” from “videos” to “content” some time between &lt;a href=&quot;https://www.youtube.com/watch?v=7e_rMYP2hlE&amp;amp;t=115&quot;&gt;september 2020&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=lnqvpe-2cyM&amp;amp;t=40&quot;&gt;january 2021&lt;/a&gt; (I don’t recommend opening these in a non-private session lest one wishes to plague their recommendations with entrepreneur slop). I don’t think this was a response to shifting language, but rather the source of the language shift. when the words used to describe a thing are imbued in the interfaces one uses to interact with the creation of a thing, the new language shadows the original words.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blog.youtube/creator-and-artist-stories/daniel-el-travieso-youtuber/&quot;&gt;youtube used “youtuber” in october 2020&lt;/a&gt;, yet &lt;a href=&quot;https://blog.youtube/creator-and-artist-stories/13-standout-black-creators/&quot;&gt;“creators” that produced “exceptional content” in 2024&lt;/a&gt;. of course, they’ve &lt;a href=&quot;https://blog.youtube/news-and-events/youtube-studio-better-insights-new/&quot;&gt;always kinda used “content”&lt;/a&gt; if you ctrl+f hard enough, but I feel like we, as beings in the world, thought of it as “corporate speak” that we shouldn’t adopt&lt;/p&gt;
&lt;p&gt;and yet we did&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;it-sucks-though&quot;&gt;
&lt;h2&gt;it sucks though&lt;/h2&gt;
&lt;p&gt;creatures make things. living things with sentience make things. they make videos, books, posts, blogs, art, music, whatever. it’s a creative process, one that laborious hours, days, weeks, maybe months, and maybe years are put into. by calling the things we create “content”, we lose that creative process. it shifts the focus of art from the process—the creative juices and work put into an art piece—to the result. the thing to be Consumed, by Consumers, as part of the Content Market, where likes are power and money’s the end all be all of whatever you create.&lt;/p&gt;
&lt;p&gt;by calling things “content”, we implicitly support this dynamic. the dynamic of corporations controlling the art we create, reducing it to views, likes, and followers. we implicitly shift our mind to the false idea that the end result is the sole part of creation that matters. not relaxation, not allowing our creative mind to flow, not for the simple self-fulfillment of pursuing an idea. what matters is that your Followers get the Content that they want, and your enjoyment of creation should be put on the sideline for them&lt;/p&gt;
&lt;p&gt;this “creator economy” is fueled by malice. we constantly butt heads with others and put ourselves down over the most menial things—“this art isn’t worth $5000”, “you shouldn’t be gatekeeping information”, “why did this get 1000 likes, but my serious work only gets 50?”. these problems have always existed—I’m not saying they’re new by any means—but it kinda feels more. I dunno. harsh now. meaningful? by stealing away followers and likes, ruining the “economy” brought on by the Gods above, who can make whatever changes they want for whatever reason? yeah. it’s hard to describe.&lt;/p&gt;
&lt;p&gt;it’s a stupid dilemma of “artists need to make money because our shitty society doesn’t have UBI” and “art should be for the artist’s sake, not for anyone else’s”. the 2nd breaks down because the 1st is true. when artists need to create art to survive, they’re not creating for their own sake, but rather for the sake of others, wherein likes bring in ad revenue and adopts and sticker sales and t-shirt sales and what have you. all for the benefit of the corporations running the “platforms” we use.&lt;/p&gt;
&lt;p&gt;society is a mess.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;am-I-alone&quot;&gt;
&lt;h2&gt;am I alone?&lt;/h2&gt;
&lt;p&gt;I’ve only seen &lt;a href=&quot;https://jeffgarvin.substack.com/p/please-stop-calling-it-content&quot;&gt;one person blog about this&lt;/a&gt; and &lt;a href=&quot;https://old.reddit.com/r/unpopularopinion/comments/14sqoig/the_term_content_creator_is_dumb_and_we_should/&quot;&gt;one other person make a reddit post about it&lt;/a&gt;. maybe there’s more laments across microblogging sites or youtube videos or private MUCs, but not many people are saying it outright&lt;/p&gt;
&lt;p&gt;so, I dunno, be loud about it. call the things your favorite artists make art. your favorite documentarians’ videos documentaries. your favorite blogger’s blog posts… blog posts. books, novels, short stories, audio, music, sound design, gadgets, doodads, doohickeys, whatever. the more people stop using that corporatized, demeaning, way-too-general word, the better in my books&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;just-stop-saying-it&quot;&gt;
&lt;h2&gt;just stop saying it&lt;/h2&gt;
&lt;p&gt;I’m not saying ban it all together, of course. that’d be awkward. “table of contents” is a pretty established phrase I’d say, and trying to change that due to the actions of corporatespeak isn’t quite the battle we should be fighting. content is still a perfectly fine word when used to describe… the contents of something. “the content of the video”, “the content of this post”—there’s no better word for that kind of thing. I’m just saying to not use the word to describe the thing that some being made itself&lt;/p&gt;
&lt;p&gt;I propose a split of the word—capital-C Content and lowercase-c content. reserve Content for the youtube trending tab. reserve Content for the seo-optimized slop that plagues a googler’s front page. reserve Content as an insult, not as the default. make Content Creator an insult to those making Content for the sole purpose of gaming something—living off our attention, and not for their own sake. then reserve the words identifying the thing created for the living beings. the artists. the documentarians. the bloggers. all the like. an artist makes art—or music, sometimes; a blogger builds a blog; a documentarian makes documentaries; an essayist makes opinion pieces, video essays, whatever it may be. just, not “content”. lowercase-c content shall be used when appropriate, of course. the content of this blog post supports that claim&lt;/p&gt;
&lt;p&gt;thanks for reading. more text-focused content on the way. be sure to Follow and Like each post, as that’s obviously what matters the most&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>music on my mind</title>
			<link rel="alternate" href="/~yosh/blog/music-on-my-mind-2024-06-04.html" />
			<id>urn:uuid:9a89e721-5dfe-4ad6-a6a7-7d0162f6818f</id>
			<published>2024-06-04T16:20:13Z</published>
			<updated>2024-06-04T16:20:13Z</updated>
			<content type="html">
&lt;p&gt;I recently created a topster for myself. I don’t usually do these kinds of things, but I restricted it strictly to music that I downloaded and was released in 2024. here’s that topster:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;an image of 25 album covers next to the respective album artists and album names&quot; src=&quot;music-on-my-mind-2024-06-04-topster.webp&quot;/&gt;&lt;/p&gt;
&lt;p&gt;I’m not going to bother listing out all of what’s on here—I feel like doing so would just result in a glob of music that people would just skim over without much thought into it. instead, I think I want to make it an occasional thing to post about music that’s particularly on my mind, which I feel more accurately represents what is my current earworm. in any case, here’s the music on my mind right now&lt;/p&gt;
&lt;section id=&quot;leumas---bloom&quot;&gt;
&lt;h2&gt;leumas - bloom&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://lostfrog.bandcamp.com/album/bloom&quot;&gt;Album Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://leumasmusic.bandcamp.com/music&quot;&gt;Artist Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=KTfgRHGjUAw&quot;&gt;YouTube upload&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m sure this quote from someone I showed this to sums this up quite nicely:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[20:44] Yuri Lowendtheory: wow this is the least intense dariacore ive ever heard&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;this album treads a fine line between “plunderphonics” and “uh, mashcore? dariacore?”. those words probably mean nothing to most people reading this, so I’ll just try to describe what I like about it. it’s almost like a sample collage, but rather than going down the likes of incoherent random darts and more confusion than music, everything flows into each other in a very… laid back way. if you’ve listened to dariacore by leroy, you’d see what I mean by the distinction of this album. it oddly feels like an album I can chill too—I’m actually listening to it while writing this post, lmao. definitely one of my favorite albums released this year, and probably up there with my top-tier albums ever. definitely looking at this artist some more&lt;/p&gt;
&lt;p&gt;&lt;em&gt;favorite track: &lt;a href=&quot;https://www.youtube.com/watch?v=yo3qp1ztxmc&quot;&gt;timeshare&lt;/a&gt;. the segment from 0:40 to 1:10 is so… dreamy? I love how they layered the vocals with the instrumental—it’s a perfect fit&lt;/em&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;tdstr---7-Grand-Dance&quot;&gt;
&lt;h2&gt;tdstr - 7 Grand Dance&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://tdstr.bandcamp.com/&quot;&gt;Album Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://li.sten.to/7granddance&quot;&gt;Other links&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;a spiritual successor to &lt;a href=&quot;https://tdstr.bandcamp.com/album/internet-brainrot&quot;&gt;internet brainrot&lt;/a&gt;, this album is (very nearly) entirely in 7/4 time signature, just like good ol’ vsnares. unlike vsnares, however, we aren’t stopping at silly little “breakcore”—we’re going beyond the percussion and embracing the samples of cyberspace. good fucking shit right here. music nerds and internet nerds unite&lt;/p&gt;
&lt;p&gt;&lt;em&gt;favorite track: &lt;a href=&quot;https://tdstr.bandcamp.com/track/dont-tell-me&quot;&gt;don’t tell me&lt;/a&gt;. kicks to make you spasm&lt;/em&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;undernet---undernet-compilation-vol1&quot;&gt;
&lt;h2&gt;under.net - under.net compilation vol.1&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://undernet.bandcamp.com/album/under-net-compilation-vol-1&quot;&gt;Album Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=UHIGqL13IoY&quot;&gt;YouTube upload&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I first heard of beansclub when I was randomly scrolling through bandcamp one day with the tag “sextrance” and came across his bootleg comp vol. 1. ever since then I’ve been following his musical journey, and I feel the culmination of what he and his copatriots have made in this one compilation album has resulted in one of the best trance albums ever. it’s not all “pure trance”—LGBT for example leans elsewhere—but damn does it never sound boring. synths are repetitive enough to be trancy but not repetitive enough to be boring. the perfect mix. get lost in this one&lt;/p&gt;
&lt;p&gt;&lt;em&gt;favorite track: this one’s really tough. I mean, &lt;a href=&quot;https://undernet.bandcamp.com/track/lgbt&quot;&gt;rl1805 - LGBT&lt;/a&gt; is one of the catchiest songs I’ve ever listened to, but &lt;a href=&quot;https://undernet.bandcamp.com/track/hanshin&quot;&gt;beansclub - hanshin&lt;/a&gt; feels like I’m going to a different realm of existence. so probably both&lt;/em&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;wawawa---plastic-symphonies-the-evidence-I-was-here&quot;&gt;
&lt;h2&gt;wawawa - plastic symphonies: the evidence I was here&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://wawawa.bandcamp.com/album/plastic-symphonies-the-evidence-i-was-here&quot;&gt;Album Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=nl2A4_X5ESw&quot;&gt;YouTube upload&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’ve been trying to find someone who encapsulates all venetian snares. I’ve never been able to find that perfect sound that hits the mark—not to say that people who diverge from his classic works are bad, but I just want… &lt;strong&gt;more&lt;/strong&gt;. then wawawa came along. this album feels like you could tack all the tracks into &lt;a href=&quot;https://en.wikipedia.org/wiki/Rossz_csillag_alatt_sz%C3%BCletett&quot;&gt;Rossz Csillag Alatt Született&lt;/a&gt; and nobody would be able to tell what tracks vsnares made and what tracks wawawa made. and that’s not to say it’s a “bland copy”. everything about it is perfect. wawawa gives their own flair to their work, reminiscent of I guess… nostalgia? it sounds like what vsnares is meant to sound like in 2024. an excellent pick. glad I follow wawawa&lt;/p&gt;
&lt;p&gt;&lt;em&gt;favorite track: &lt;a href=&quot;https://wawawa.bandcamp.com/track/plastic-symphony&quot;&gt;plastic symphony&lt;/a&gt;. I mean, it’s the title track. why not go all out on it?&lt;/em&gt;&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;ハヤトムラカミ---糸波&quot;&gt;
&lt;h2&gt;ハヤトムラカミ - 糸波&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&quot;https://lostfrog.bandcamp.com/album/--15&quot;&gt;Album Bandcamp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=PNU1qfkWYyA&quot;&gt;YouTube upload&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and now for something completely different. this album is unlike any other piece of ambient work I’ve heard. one of the tracks appears on &lt;a href=&quot;https://lostfrog.bandcamp.com/album/--10&quot;&gt;a different compilation album&lt;/a&gt;, but this is the one complete work of all four of them. it feels like I’m dying. but. not really. it feels like I’m leaving for a brief moment, taken on a 30-minute journey to explore the clouds while everything else disappears around me. a sense of being in a dream, yet also more than enough sounds to ground me in the present—to not lose focus. I listen to this when I want to escape for a bit. just lie my head down and get lost in the atmosphere it creates. I hold this one dear to me&lt;/p&gt;
&lt;p&gt;&lt;em&gt;favorite track: &lt;a href=&quot;https://lostfrog.bandcamp.com/track/--151&quot;&gt;糸波Ⅳ&lt;/a&gt;. a brief visit to a cosmological cafe, near the end of the journey, where voices bustle and slowly you get ushered down to the world of the living. gives me chills when listening to it, and that’s something music almost never does to me&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;so. that’s the music on my mind. until next time&lt;/p&gt;
&lt;/section&gt;</content>
		</entry><entry>
			<title>buying some microns</title>
			<link rel="alternate" href="/~yosh/blog/buying-some-microns.html" />
			<id>urn:uuid:c41e5e17-6e04-4e7d-8b75-8895455dcb73</id>
			<published>2024-05-04T08:23:00Z</published>
			<updated>2024-05-04T08:23:00Z</updated>
			<content type="html">
&lt;p&gt;I’m buying some pigma microns. just an 8-pack of 0.05mm ones. I already had a 6-pack of ones ranging from like 0.005mm to 0.1mm, but they’re quite old and I want to draw more, so that one pack isn’t going to cut it&lt;/p&gt;
&lt;p&gt;I’ve always been in a little cycle of “wanting to draw” to “never drawing for months”. it’s not really a motivational “my art sucks” kinda way, moreso just getting bored. but I’d rather disconnect from everything for a bit and. draw. I guess&lt;/p&gt;
&lt;p&gt;I’ve always randomly sketched, studied, and gesture drew, but I’ve never properly learned fundamentals. I still chicken-scratch not out of style choice, but out of habit. I’m gonna try out &lt;a href=&quot;https://drawabox.com&quot;&gt;drawabox&lt;/a&gt;‘s tutorials and exercises. some hours of the day—mostly during free time—will be dedicated. hopefully every day, minus the time when I’ll be at fwa, of course. maybe I’ll start after fwa? I dunno.&lt;/p&gt;
&lt;p&gt;one day I hope to look back at this blog post and smile at how it was the start of honing a skill I enjoy doing. maybe I should do this for more things&lt;/p&gt;</content>
		</entry></feed>
