Making ())( not a palindrome anymore – defining “conjugate palindromicity”

One of the top posts on r/Showerthoughts is It’s off-putting that ()() isn’t a palindrome, yet ())( is.

I agree.

The absolute value operator |x| is first taught as “if x is negative, make it positive.” This falls apart with complex numbers. Then |z| is retaught as “multiply z by its conjugate, then take the square root of the result.”

What is “the conjugate of z?” Complex numbers come in conjugate pairs; think of them as opposite sides of the same coin. -1 has two square roots: i and –i. The conjugate of z is the number you get by choosing the other square root. For example, the conjugate of -3 – 4i is -3 + 4i.

In much the same way, English (and other languages) have conjugate symbols. Just as -3 – 4i and -3 + 4i are a conjugate pair, so too are ( and ) a conjugate pair.

The usual definition of a “palindrome” is “a sequence of symbols that reads the same forwards and backwards” which is to say “a sequence that is identical to its own reverse.” The sequence is symmetric under the operation of reversal. With this definition, ()() is not a palindrome, and ())( is. That can’t be right, so the definition is wrong.

The way conjugate symbols work is fundamentally tied to their position in the sequence. A ( at the beginning of the string means the same, in reverse, as a ) at the end of the string. So I make a new definition – conjugate palindromicity. A sequence of symbols is a conjugate palindrome if it is symmetric under the operation of reversal and the replacement of all symbols with their conjugate.

I wrote a PowerShell script which tests strings for both palindromicity and conjugate palindromicity.

Test-Palindrome.ps1

> .\Test-Palindrome.ps1 "()()"; .\Test-Palindrome.ps1 "())("; .\Test-Palindrome.ps1 "()()" -conjugate; .\Test-Palindrome.ps1 "())(" -conjugate
False
True
True
False

Under this new definition, happily, ()() is a conjugate palindrome, and ())( is not (as it should not be.)

Reversal and conjugation applied to ()() and ())(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s