Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8477957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:36:39+00:00 2026-06-10T18:36:39+00:00

What is the simplest way to take an input vector, given as (x,y,z), and

  • 0

What is the simplest way to take an input vector, given as (x,y,z), and find some new vector with a different direction than it? Any direction will do, it just has to be a different direction than the input (other than exact opposite direction, which is trivial).

It seems like there should be a simple solution that does not involve branching, but I can’t seem to find one, and after some though, I’m interested to know if there actually is one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:36:41+00:00Added an answer on June 10, 2026 at 6:36 pm

    I’m not sure how simple this is, but assuming that (x,y,z) has length L (which is not 0) the vector below has length 1 and is at right angles to (x,y,z)

    -y * (x + sign(x)*L) / (L*(L+|x|))
    1 - y * y / (L*(L+|x|))
    -y * z / (L*(L+|x|))
    

    (here |x| is the absolute value of x and sign(x) is -1 if x<0, and 1 if x >= 0)

    I derived this formula by computing the householder reflection ( eg http://en.wikipedia.org/wiki/Householder_transformation) that maps (x,y,z) to a multiple of (1,0,0) and then computing the image of (0,1,0) under this matrix; since the matrix is both orthogonal and symmetric this vector will be orthogonal to (x,y,z).

    There is no continuous function (x,y,z) -> (x’,y’,z’) (for (x,y,z) != (0,0,0)) such that (x’,y’,z’) is never a multiple of (x,y,z); if there were you could remove from (x’,y’,z’) its component in the (x,y,z) direction and so get a continuous map (x,y,z)->(x”,y”,z”) where (x”,y”,z”) is at right angles to (x,y,z), but by the hairy ball theorem you can’t.

    In the formula above the occurrence of the discontinuous sign function makes the formula discontinuous. Note that sign needn’t involve a branch; in some languages there is a build in function to do it; in C you could use 2*(x>=0)-1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for the simplest way to take a single variable such as: $variable
The simplest way to deal with python package installations, so far, to me, has
What is the simplest way of taking the comment/s from the metadata of a
What is the easiest/simplest way to delay inside a function without having to delay
what is the simplest way to get all rows where a complex condition holds
What is the simplest way to do a binary search on an (already) sorted
What's the simplest way to list all the files in a git repo a
What's the simplest/canonical way to create an empty file in C#/.NET? The simplest way
What is the simplest way to call a program from with a piece of
What is the simplest way to delete records with duplicate name in a table?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.