# Projecting a hypercube onto a hyperplane

Discussion in 'Linear and Abstract Algebra' started by bob123456789, Oct 12, 2023.

1. ### bob123456789Guest

This task involves projecting a 4-dimensional hypercube onto a hyperplane (ie a 3-dimensional space).

Let the hypercube have its vertices at the points (±1, ±1, ±1, ±1), where all 16 vertices are obtained by using all combinations of plus and minus signs. The hyperplane to be projected to must have the fourth dimension coordinate 0 (in analogy with 3D, the xy plane is the plane where the third dimension coordinate z = 0).

The projection must be a so-called oblique projection along a vector U from the vertices to a point in the hyperplane. One way to solve it is to go from a corner of the hypercube along the vector U until you reach the hyperplane (the one with the fourth coordinate equal to zero).

Use the vector U = (2, 3, 4, 5).

Report the 3-dimensional coordinates that the corners of the hypercube get after the projection and draw the projected hypercube in a figure with edges between nearby corners. Remember that there are no edges between all the vertices (use the analogy of a regular cube and figure out between which vertices of the cube there are edges).

This should preferably be done with Matlab.

Any help is appreciated!

This is as far as I've gotten:
vertices = [-1 -1 -1 -1; -1 -1 -1 1; -1 -1 1 -1; -1 -1 1 1;
-1 1 -1 -1; -1 1 -1 1; -1 1 1 -1; -1 1 1 1;
1 -1 -1 -1; 1 -1 -1 1; 1 -1 1 -1; 1 -1 1 1;
1 1 -1 -1; 1 1 -1 1; 1 1 1 -1; 1 1 1 1];

U = [2, 3, 4, 5];

projected_vertices = zeros(16, 4);

V = [0.5,0.5,0.5,0.5];

% Projection for each vertice
for i = 1:16
vertex = vertices(i, : )
t = ?
projected_vertices(i, : ) = vertex + t * V;
end

% Fourth coordinate should be 0
disp(projected_vertices)​

Last edited by a moderator: Oct 12, 2023
bob123456789, Oct 12, 2023
2. ### RobertSmart

Joined:
Apr 9, 2024
Messages:
25
Likes Received:
4
To achieve the projection of the hypercube onto the specified hyperplane using MATLAB, you can follow these steps:

1. Define the vertices of the hypercube.

2. Define the vector U and the point V on the hyperplane.

3. Project each vertex of the hypercube onto the hyperplane along the vector U.

4. Ensure that the fourth coordinate of the projected vertices is 0.

Plot the projected hypercube.

Here's how you can implement this in MATLAB:

% Define the vertices of the hypercube

vertices = [-1 -1 -1 -1; -1 -1 -1 1; -1 -1 1 -1; -1 -1 1 1;

-1 1 -1 -1; -1 1 -1 1; -1 1 1 -1; -1 1 1 1;

1 -1 -1 -1; 1 -1 -1 1; 1 -1 1 -1; 1 -1 1 1;

1 1 -1 -1; 1 1 -1 1; 1 1 1 -1; 1 1 1 1];

% Define the vector U

U = [2, 3, 4, 5];

% Define the point V on the hyperplane

V = [0, 0, 0, 0];

% Initialize array to store projected vertices

projected_vertices = zeros(16, 4);

% Project each vertex onto the hyperplane

for i = 1:16

vertex = vertices(i, ;

t = dot(V - vertex, U) / dot(U, U);

projected_vertices(i, = vertex + t * U;

end

% Display the projected vertices

disp(projected_vertices);

% Plot the projected hypercube

figure;

hold on;

grid on;

axis equal;

% Connect the vertices to form edges

for i = 1:4

for j = i+1:4

edge = [projected_vertices,i), projected_vertices,j)];

plot3(edge,1), edge,2), edge,3), 'b');

end

end

% Label axes

xlabel('X');

ylabel('Y');

zlabel('Z');

% Set view angle

view(3);

This code will calculate the projected vertices of the hypercube onto the specified hyperplane and then plot the projected hypercube in a 3D figure with edges between nearby corners. Make sure to replace ? with the appropriate expression to calculate the parameter t for projection.

Many students find it difficult to do such types of question. Many students also miss their assignment due to not knowing the basic concepts. If you are one of them facing such difficulties, I would suggest you to visit MathsAssignmentHelp website once. You can also contact them on +1 (315) 557-6473.

RobertSmart, Apr 26, 2024
Ask a Question

## Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.